Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: snackbar redesign #598

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/components/AppSnackbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
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"
>
<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 +48,9 @@ export default {
},
timeout() {
return this.$store.state.snackbar.timeout
},
variant() {
return this.$store.state.snackbar.variant
}
}
}
Expand All @@ -65,6 +68,7 @@ export default {
margin: 0 auto;
border-radius: 0;
max-width: 300px;
border: 2px solid transparent;
}

:deep(.v-snackbar__content) {
Expand All @@ -83,6 +87,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: ''
juliahermak marked this conversation as resolved.
Show resolved Hide resolved
}

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
Loading