Updated listButton styles. Add error state with dynamic error message.

This commit is contained in:
Bryan 2021-11-09 13:09:34 -05:00
parent 9981ae616a
commit 703919cd10
3 changed files with 33 additions and 10 deletions

View file

@ -41,6 +41,7 @@
<div class="col my-3 d-flex align-items-center"> <div class="col my-3 d-flex align-items-center">
<listButton <listButton
buttonText="List Button" buttonText="List Button"
errorText="Test error message"
/> />
</div> </div>
</div> </div>

View file

@ -91,11 +91,28 @@
height: 48px; height: 48px;
transition: all 150ms linear; transition: all 150ms linear;
border-radius: $border-radius-lg; border-radius: $border-radius-lg;
border: 1px solid rgba($gray-300,.3); border: 1px solid $gray-500;
width: 100%; width: 100%;
&:hover {
box-shadow: 0 0 0 4px $blue-100;
}
&:focus, // Mouse, touch, stylus focus &:focus, // Mouse, touch, stylus focus
&:focus-visible { // Keyboard focus for accessibility &:focus-visible { // Keyboard focus for accessibility
box-shadow: none; box-shadow: 0 0 0 2px $blue;
}
&:active {
background: $blue-100;
border: 1px solid $blue;
}
+ label {
display: none;
}
&.error {
border: 1px solid $danger;
~ label {
display: flex;
color: $danger;
}
} }
&.button-loader { &.button-loader {
padding: 0 40px 0 12px; padding: 0 40px 0 12px;

View file

@ -1,22 +1,27 @@
<template> <template>
<button <div class="d-flex flex-column w-100">
class="btn list-button d-flex align-items-center" <button
v-on:click="showLoader()" class="btn list-button d-flex align-items-center"
v-bind:class="[this.isLoading ? 'button-loader' : 'not-loading']" v-on:click="showLoader()"
> v-bind:class="[this.isLoading ? 'button-loader' : 'not-loading',this.isError ? 'error' : '']"
{{ this.buttonText }} >
</button> {{ this.buttonText }}
</button>
<label class="small mt-1">{{ this.errorText }}</label>
</div>
</template> </template>
<script> <script>
export default { export default {
name: "listButton", name: "listButton",
props: { props: {
buttonText: String buttonText: String,
errorText: String
}, },
data() { data() {
return { return {
isLoading: false, isLoading: false,
isError: false
}; };
}, },
methods: { methods: {