feat: update banner design [CW-1491] (#7296)

* refactor: banner styling

* refactor: update button style for reply assign banner

* feat: remove update-banner classes

---------

Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
This commit is contained in:
Shivam Mishra
2023-06-14 12:56:42 +05:30
committed by GitHub
parent 23ca6d56f9
commit c755978352
4 changed files with 61 additions and 32 deletions

View File

@@ -115,11 +115,6 @@ export default {
<style lang="scss"> <style lang="scss">
@import './assets/scss/app'; @import './assets/scss/app';
.update-banner {
height: var(--space-larger);
align-items: center;
font-size: var(--font-size-small) !important;
}
</style> </style>
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style> <style src="vue-multiselect/dist/vue-multiselect.min.css"></style>

View File

@@ -1,7 +1,6 @@
<template> <template>
<banner <banner
v-if="shouldShowBanner" v-if="shouldShowBanner"
class="update-banner"
color-scheme="primary" color-scheme="primary"
:banner-message="bannerMessage" :banner-message="bannerMessage"
href-link="https://github.com/chatwoot/chatwoot/releases" href-link="https://github.com/chatwoot/chatwoot/releases"

View File

@@ -11,26 +11,29 @@
{{ hrefLinkText }} {{ hrefLinkText }}
</a> </a>
</span> </span>
<woot-button <div class="actions">
v-if="hasActionButton" <woot-button
size="small" v-if="hasActionButton"
variant="link" size="tiny"
icon="arrow-right" icon="arrow-right"
color-scheme="primary" :variant="actionButtonVariant"
class-names="banner-action__button" color-scheme="primary"
@click="onClick" class-names="banner-action__button"
> @click="onClick"
{{ actionButtonLabel }} >
</woot-button> {{ actionButtonLabel }}
<woot-button </woot-button>
v-if="hasCloseButton" <woot-button
size="small" v-if="hasCloseButton"
variant="link" size="tiny"
color-scheme="secondary" :color-scheme="colorScheme"
icon="dismiss-circle" icon="dismiss-circle"
class-names="banner-action__button" class-names="banner-action__button"
@click="onClickClose" @click="onClickClose"
/> >
{{ $t('GENERAL_SETTINGS.DISMISS') }}
</woot-button>
</div>
</div> </div>
</template> </template>
@@ -53,6 +56,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
actionButtonVariant: {
type: String,
default: '',
},
actionButtonLabel: { actionButtonLabel: {
type: String, type: String,
default: '', default: '',
@@ -68,7 +75,12 @@ export default {
}, },
computed: { computed: {
bannerClasses() { bannerClasses() {
return [this.colorScheme]; const classList = [this.colorScheme, `banner-align-${this.align}`];
if (this.hasActionButton || this.hasCloseButton) {
classList.push('has-button');
}
return classList;
}, },
}, },
methods: { methods: {
@@ -84,17 +96,26 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.banner { .banner {
--x-padding: var(--space-normal);
--y-padding: var(--space-slab);
display: flex; display: flex;
gap: var(--x-padding);
color: var(--white); color: var(--white);
font-size: var(--font-size-mini); font-size: var(--font-size-mini);
padding: var(--space-slab) var(--space-normal); padding: var(--y-padding) var(--x-padding);
justify-content: center; justify-content: center;
position: sticky;
&.primary { &.primary {
background: var(--w-500); background: var(--w-500);
.banner-action__button { .banner-action__button {
background: var(--w-600);
border: none;
color: var(--white); color: var(--white);
&:hover {
background: var(--w-800);
}
} }
} }
@@ -107,7 +128,16 @@ export default {
} }
&.alert { &.alert {
background: var(--r-400); background: var(--r-500);
.banner-action__button {
background: var(--r-700);
border: none;
color: var(--white);
&:hover {
background: var(--r-800);
}
}
} }
&.warning { &.warning {
@@ -133,8 +163,6 @@ export default {
} }
.banner-action__button { .banner-action__button {
margin: 0 var(--space-smaller);
::v-deep .button__content { ::v-deep .button__content {
white-space: nowrap; white-space: nowrap;
} }
@@ -144,5 +172,11 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.actions {
display: flex;
gap: var(--space-smaller);
right: var(--y-padding);
}
} }
</style> </style>

View File

@@ -2,6 +2,7 @@
<div class="reply-box" :class="replyBoxClass"> <div class="reply-box" :class="replyBoxClass">
<banner <banner
v-if="showSelfAssignBanner" v-if="showSelfAssignBanner"
action-button-variant="link"
color-scheme="secondary" color-scheme="secondary"
:banner-message="$t('CONVERSATION.NOT_ASSIGNED_TO_YOU')" :banner-message="$t('CONVERSATION.NOT_ASSIGNED_TO_YOU')"
:has-action-button="true" :has-action-button="true"