Skip to content

Commit

Permalink
Merge pull request #598 from Adamant-im/fix/snackbar-redesign
Browse files Browse the repository at this point in the history
fix: snackbar redesign
  • Loading branch information
bludnic authored Feb 26, 2024
2 parents 82f8274 + a788efa commit f6e4008
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
17 changes: 14 additions & 3 deletions src/components/AppSnackbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
v-model="show"
:timeout="timeout"
:color="color"
:class="className"
variant="elevated"
:class="[className, { outlined: variant === 'outlined' }]"
:variant="variant"
location="bottom"
width="100%"
:multi-line="message.length > 50"
@click:outside="show = false"
>
<div :class="`${className}__container`">
{{ message }}
<v-btn
v-if="timeout === 0 || timeout > 2000"
v-if="timeout === 0 || timeout > 2000 || timeout === -1"
size="x-small"
variant="text"
fab
Expand Down Expand Up @@ -48,6 +49,9 @@ export default {
},
timeout() {
return this.$store.state.snackbar.timeout
},
variant() {
return this.$store.state.snackbar.variant
}
}
}
Expand All @@ -65,6 +69,7 @@ export default {
margin: 0 auto;
border-radius: 0;
max-width: 300px;
border: 2px solid transparent;
}
:deep(.v-snackbar__content) {
Expand All @@ -83,6 +88,12 @@ export default {
padding: 0;
width: 36px;
}
&.outlined {
:deep(.v-snackbar__wrapper) {
border-color: map-get($adm-colors, 'danger');
}
}
}
.v-theme--light.app-snackbar {
Expand Down
7 changes: 5 additions & 2 deletions src/store/modules/snackbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ const initialState = {
show: false,
message: '',
timeout: SNACKBAR_TIMEOUT,
color: ''
color: '',
variant: ''
}

const state = () => ({
...initialState // clone object
})

const mutations = {
show(state, { message = '', timeout = SNACKBAR_TIMEOUT, color = '' }) {
show(state, { message = '', timeout = SNACKBAR_TIMEOUT, color = '', variant = '' }) {
if (message) {
state.message = message
state.color = color
state.timeout = timeout
state.variant = variant

state.show = true
}
Expand All @@ -28,6 +30,7 @@ const mutations = {
state.message = initialState.message
state.timeout = initialState.timeout
state.color = initialState.color
state.variant = initialState.variant
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/views/SendFunds.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export default {
onError(message) {
this.$store.dispatch('snackbar/show', {
message,
color: '#ED5270',
timeout: 5000
timeout: -1,
variant: 'outlined'
})
}
}
Expand Down

0 comments on commit f6e4008

Please sign in to comment.