From c681e8a01bd226c4f513211159305ee733fa92d0 Mon Sep 17 00:00:00 2001 From: Nithin David Thomas Date: Thu, 20 May 2021 13:51:46 +0530 Subject: [PATCH] chore: Refactor button styles (#2259) --- .../assets/scss/_foundation-custom.scss | 10 +- .../assets/scss/_foundation-settings.scss | 4 +- .../dashboard/assets/scss/_woot.scss | 23 ++- app/javascript/dashboard/assets/scss/app.scss | 19 -- .../dashboard/assets/scss/storybook.scss | 2 + .../assets/scss/widgets/_buttons.scss | 87 +++++--- .../assets/scss/widgets/_conv-header.scss | 3 +- .../scss/widgets/_conversation-view.scss | 1 - .../dashboard/components/ChatList.vue | 9 +- .../components/layout/AvailabilityStatus.vue | 2 + .../dashboard/components/layout/Sidebar.vue | 6 - .../layout/sidebarComponents/OptionsMenu.vue | 30 ++- .../dashboard/components/ui/WootButton.vue | 47 +++-- .../components/widgets/TableFooter.vue | 64 ++---- .../widgets/conversation/ConversationBox.vue | 2 +- .../conversation/ConversationHeader.vue | 8 +- .../widgets/conversation/bubble/Actions.vue | 2 +- .../contacts/components/ContactsTable.vue | 7 +- .../dashboard/contacts/components/Header.vue | 3 +- .../conversation/contact/ContactInfoRow.vue | 14 +- .../dashboard/settings/SettingsHeader.vue | 6 +- .../dashboard/settings/agents/EditAgent.vue | 9 +- .../dashboard/settings/agents/Index.vue | 38 ++-- .../dashboard/settings/canned/Index.vue | 44 +++-- .../routes/dashboard/settings/inbox/Index.vue | 28 +-- .../inbox/components/CampaignsTable.vue | 6 +- .../settings/integrations/Webhook.vue | 10 +- .../dashboard/settings/labels/Index.vue | 39 ++-- .../dashboard/settings/reports/Index.vue | 9 +- .../routes/dashboard/settings/teams/Index.vue | 29 +-- .../components/ui/dropdown/DropdownItem.vue | 4 +- stories/Sections/Button.stories.mdx | 185 ++++++++++++++++++ 32 files changed, 490 insertions(+), 260 deletions(-) create mode 100644 stories/Sections/Button.stories.mdx diff --git a/app/javascript/dashboard/assets/scss/_foundation-custom.scss b/app/javascript/dashboard/assets/scss/_foundation-custom.scss index 9c398e078..61ead3492 100644 --- a/app/javascript/dashboard/assets/scss/_foundation-custom.scss +++ b/app/javascript/dashboard/assets/scss/_foundation-custom.scss @@ -6,13 +6,11 @@ border-radius: 1000px; } - &.grey-btn { - color: $color-gray; - &:hover { - color: $color-light-gray; - } - } +} + +.button-wrapper .button.link.grey-btn { + margin-left: var(--space-normal); } .tooltip { diff --git a/app/javascript/dashboard/assets/scss/_foundation-settings.scss b/app/javascript/dashboard/assets/scss/_foundation-settings.scss index dbdb630c0..56d82896b 100644 --- a/app/javascript/dashboard/assets/scss/_foundation-settings.scss +++ b/app/javascript/dashboard/assets/scss/_foundation-settings.scss @@ -238,7 +238,7 @@ $breadcrumbs-item-slash: true; // 11. Button // ---------- -$button-padding: var(--space-one) var(--space-slab); +$button-padding: var(--space-smaller) 1em; $button-margin: 0 0 $global-margin 0; $button-fill: solid; $button-background: $primary-color; @@ -246,7 +246,7 @@ $button-background-hover: scale-color($button-background, $lightness: -15%); $button-color: $white; $button-color-alt: $white; $button-radius: var(--border-radius-normal); -$button-sizes: (tiny: var(--font-size-nano), +$button-sizes: (tiny: var(--font-size-micro), small: var(--font-size-mini), default: var(--font-size-small), large: var(--font-size-medium)); diff --git a/app/javascript/dashboard/assets/scss/_woot.scss b/app/javascript/dashboard/assets/scss/_woot.scss index e53ceef73..7ecec198b 100644 --- a/app/javascript/dashboard/assets/scss/_woot.scss +++ b/app/javascript/dashboard/assets/scss/_woot.scss @@ -1,8 +1,28 @@ +@import 'shared/assets/fonts/inter'; +@import 'shared/assets/stylesheets/colors'; +@import 'shared/assets/stylesheets/spacing'; +@import 'shared/assets/stylesheets/font-size'; +@import 'shared/assets/stylesheets/font-weights'; +@import 'shared/assets/stylesheets/shadows'; +@import 'shared/assets/stylesheets/border-radius'; + +@import 'variables'; + +@import 'mixins'; +@import 'foundation-settings'; +@import 'helper-classes'; + +@import 'foundation-sites/scss/foundation'; +@import '~bourbon/core/bourbon'; + +@include foundation-everything($flex: true); + + @import 'typography'; @import 'layout'; @import 'animations'; - @import 'foundation-custom'; + @import 'widgets/buttons'; @import 'widgets/conv-header'; @import 'widgets/conversation-card'; @@ -27,3 +47,4 @@ @import 'plugins/multiselect'; @import 'plugins/dropdown'; @import '@chatwoot/prosemirror-schema/src/woot-editor.css'; +@import '~shared/assets/stylesheets/ionicons'; diff --git a/app/javascript/dashboard/assets/scss/app.scss b/app/javascript/dashboard/assets/scss/app.scss index dbf3a6e78..13c3dd557 100644 --- a/app/javascript/dashboard/assets/scss/app.scss +++ b/app/javascript/dashboard/assets/scss/app.scss @@ -1,20 +1 @@ -@import 'shared/assets/fonts/inter'; -@import 'shared/assets/stylesheets/colors'; -@import 'shared/assets/stylesheets/spacing'; -@import 'shared/assets/stylesheets/font-size'; -@import 'shared/assets/stylesheets/font-weights'; -@import 'shared/assets/stylesheets/shadows'; -@import 'shared/assets/stylesheets/border-radius'; -@import 'variables'; - -@import '~spinkit/scss/spinners/7-three-bounce'; -@import '~shared/assets/stylesheets/ionicons'; - -@import 'mixins'; -@import 'foundation-settings'; -@import 'helper-classes'; -@import 'foundation-sites/scss/foundation'; -@import '~bourbon/core/bourbon'; - -@include foundation-everything($flex: true); @import 'woot'; diff --git a/app/javascript/dashboard/assets/scss/storybook.scss b/app/javascript/dashboard/assets/scss/storybook.scss index fbe88bc3f..f6a9d5eb3 100644 --- a/app/javascript/dashboard/assets/scss/storybook.scss +++ b/app/javascript/dashboard/assets/scss/storybook.scss @@ -14,6 +14,8 @@ @import 'foundation-settings'; @import 'helper-classes'; @import 'foundation-sites/scss/foundation'; + +@include foundation-prototype-spacing; @import '~bourbon/core/bourbon'; @include foundation-everything($flex: true); diff --git a/app/javascript/dashboard/assets/scss/widgets/_buttons.scss b/app/javascript/dashboard/assets/scss/widgets/_buttons.scss index a599721c2..1d6b12631 100644 --- a/app/javascript/dashboard/assets/scss/widgets/_buttons.scss +++ b/app/javascript/dashboard/assets/scss/widgets/_buttons.scss @@ -1,4 +1,7 @@ .button { + align-items: center; + display: inline-flex; + height: 4.0rem; margin-bottom: 0; &.button--emoji { @@ -19,52 +22,76 @@ } } - - - &.icon { - padding-left: $space-normal; - padding-right: $space-normal; - - i { - padding-right: $space-small; - } + .spinner { + padding: 0 var(--space-small); } - &.nice { - border-radius: $space-smaller; + .icon+.button__content { + padding-left: var(--space-small); } - &.hollow { - &.link { - border-color: transparent; - padding-left: 0; - - &:hover, - &:focus { - border-color: transparent; - } - } - } - - >.icon { - font-size: $font-size-default; - } - - &.tiny { - font-size: $font-size-mini; - padding: $space-small $space-slab; + &.expanded { + display: flex; + justify-content: center; } &.round { border-radius: $space-larger; } + // @TODO Use with link + &.compact { padding-bottom: 0; padding-top: 0; } + + // Smooth style + &.smooth { + @include button-style(var(--w-100), var(--w-50), var(--w-700)); + + + &.secondary { + @include button-style(var(--s-100), var(--s-50), var(--s-700)); + } + + &.success { + @include button-style(var(--g-100), var(--g-50), var(--g-700)); + } + + &.alert { + @include button-style(var(--r-100), var(--r-50), var(--r-700)); + } + + &.warning { + @include button-style(var(--y-200), var(--y-100), var(--y-900)); + } + } + + // Sizes + &.tiny { + height: var(--space-medium); + } + + &.small { + height: var(--space-large); + } + + &.large { + height: var(--space-larger); + } + + &.link { + height: auto; + margin: 0; + padding: 0; + } + + } + +// @TDOD move to utility file .button--fixed-right-top { position: fixed; right: $space-small; diff --git a/app/javascript/dashboard/assets/scss/widgets/_conv-header.scss b/app/javascript/dashboard/assets/scss/widgets/_conv-header.scss index 1c081c089..f286c7bc0 100644 --- a/app/javascript/dashboard/assets/scss/widgets/_conv-header.scss +++ b/app/javascript/dashboard/assets/scss/widgets/_conv-header.scss @@ -2,11 +2,11 @@ $resolve-button-width: 13.2rem; // Conversation header - Light BG .conv-header { - @include padding($space-small $space-normal); @include background-white; @include flex; @include flex-align($x: justify, $y: middle); @include border-normal-bottom; + padding: var(--space-small) var(--space-normal); .multiselect-box { @include flex; @@ -70,6 +70,7 @@ $resolve-button-width: 13.2rem; .header-actions-wrap { + align-items: center; display: flex; flex-direction: row; flex-grow: 1; diff --git a/app/javascript/dashboard/assets/scss/widgets/_conversation-view.scss b/app/javascript/dashboard/assets/scss/widgets/_conversation-view.scss index bc3e20254..d79cfe80d 100644 --- a/app/javascript/dashboard/assets/scss/widgets/_conversation-view.scss +++ b/app/javascript/dashboard/assets/scss/widgets/_conversation-view.scss @@ -76,7 +76,6 @@ .status--filter { @include padding($zero null $zero $space-normal); - @include round-corner; @include margin($space-smaller $space-slab $zero $zero); background-color: $color-background-light; border: 1px solid $color-border; diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 3b7fe0b8c..0aba2739f 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -32,13 +32,14 @@ -
{{ $t('CHAT_LIST.LOAD_MORE_CONVERSATIONS') }} -
+

-@import '~dashboard/assets/scss/app.scss'; +@import '~dashboard/assets/scss/woot'; .spinner { margin-top: var(--space-normal); margin-bottom: var(--space-normal); diff --git a/app/javascript/dashboard/components/layout/AvailabilityStatus.vue b/app/javascript/dashboard/components/layout/AvailabilityStatus.vue index 72488b82e..8587bacc8 100644 --- a/app/javascript/dashboard/components/layout/AvailabilityStatus.vue +++ b/app/javascript/dashboard/components/layout/AvailabilityStatus.vue @@ -22,6 +22,8 @@ > - + - + - + {{ $t('SIDEBAR_ITEMS.PROFILE_SETTINGS') }} - + {{ $t('SIDEBAR_ITEMS.LOGOUT') }} - + diff --git a/app/javascript/dashboard/components/ui/WootButton.vue b/app/javascript/dashboard/components/ui/WootButton.vue index 4df156f3a..a71e5388e 100644 --- a/app/javascript/dashboard/components/ui/WootButton.vue +++ b/app/javascript/dashboard/components/ui/WootButton.vue @@ -1,13 +1,7 @@