chore: Refactor button styles (#2259)

This commit is contained in:
Nithin David Thomas 2021-05-20 13:51:46 +05:30 committed by GitHub
parent af8e681f2a
commit c681e8a01b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 490 additions and 260 deletions

View file

@ -6,13 +6,11 @@
border-radius: 1000px; 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 { .tooltip {

View file

@ -238,7 +238,7 @@ $breadcrumbs-item-slash: true;
// 11. Button // 11. Button
// ---------- // ----------
$button-padding: var(--space-one) var(--space-slab); $button-padding: var(--space-smaller) 1em;
$button-margin: 0 0 $global-margin 0; $button-margin: 0 0 $global-margin 0;
$button-fill: solid; $button-fill: solid;
$button-background: $primary-color; $button-background: $primary-color;
@ -246,7 +246,7 @@ $button-background-hover: scale-color($button-background, $lightness: -15%);
$button-color: $white; $button-color: $white;
$button-color-alt: $white; $button-color-alt: $white;
$button-radius: var(--border-radius-normal); $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), small: var(--font-size-mini),
default: var(--font-size-small), default: var(--font-size-small),
large: var(--font-size-medium)); large: var(--font-size-medium));

View file

@ -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 'typography';
@import 'layout'; @import 'layout';
@import 'animations'; @import 'animations';
@import 'foundation-custom'; @import 'foundation-custom';
@import 'widgets/buttons'; @import 'widgets/buttons';
@import 'widgets/conv-header'; @import 'widgets/conv-header';
@import 'widgets/conversation-card'; @import 'widgets/conversation-card';
@ -27,3 +47,4 @@
@import 'plugins/multiselect'; @import 'plugins/multiselect';
@import 'plugins/dropdown'; @import 'plugins/dropdown';
@import '@chatwoot/prosemirror-schema/src/woot-editor.css'; @import '@chatwoot/prosemirror-schema/src/woot-editor.css';
@import '~shared/assets/stylesheets/ionicons';

View file

@ -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'; @import 'woot';

View file

@ -14,6 +14,8 @@
@import 'foundation-settings'; @import 'foundation-settings';
@import 'helper-classes'; @import 'helper-classes';
@import 'foundation-sites/scss/foundation'; @import 'foundation-sites/scss/foundation';
@include foundation-prototype-spacing;
@import '~bourbon/core/bourbon'; @import '~bourbon/core/bourbon';
@include foundation-everything($flex: true); @include foundation-everything($flex: true);

View file

@ -1,4 +1,7 @@
.button { .button {
align-items: center;
display: inline-flex;
height: 4.0rem;
margin-bottom: 0; margin-bottom: 0;
&.button--emoji { &.button--emoji {
@ -19,52 +22,76 @@
} }
} }
.spinner {
padding: 0 var(--space-small);
&.icon {
padding-left: $space-normal;
padding-right: $space-normal;
i {
padding-right: $space-small;
}
} }
&.nice { .icon+.button__content {
border-radius: $space-smaller; padding-left: var(--space-small);
} }
&.hollow { &.expanded {
&.link { display: flex;
border-color: transparent; justify-content: center;
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;
} }
&.round { &.round {
border-radius: $space-larger; border-radius: $space-larger;
} }
// @TODO Use with link
&.compact { &.compact {
padding-bottom: 0; padding-bottom: 0;
padding-top: 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 { .button--fixed-right-top {
position: fixed; position: fixed;
right: $space-small; right: $space-small;

View file

@ -2,11 +2,11 @@ $resolve-button-width: 13.2rem;
// Conversation header - Light BG // Conversation header - Light BG
.conv-header { .conv-header {
@include padding($space-small $space-normal);
@include background-white; @include background-white;
@include flex; @include flex;
@include flex-align($x: justify, $y: middle); @include flex-align($x: justify, $y: middle);
@include border-normal-bottom; @include border-normal-bottom;
padding: var(--space-small) var(--space-normal);
.multiselect-box { .multiselect-box {
@include flex; @include flex;
@ -70,6 +70,7 @@ $resolve-button-width: 13.2rem;
.header-actions-wrap { .header-actions-wrap {
align-items: center;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-grow: 1; flex-grow: 1;

View file

@ -76,7 +76,6 @@
.status--filter { .status--filter {
@include padding($zero null $zero $space-normal); @include padding($zero null $zero $space-normal);
@include round-corner;
@include margin($space-smaller $space-slab $zero $zero); @include margin($space-smaller $space-slab $zero $zero);
background-color: $color-background-light; background-color: $color-background-light;
border: 1px solid $color-border; border: 1px solid $color-border;

View file

@ -32,13 +32,14 @@
<span class="spinner"></span> <span class="spinner"></span>
</div> </div>
<div <woot-button
v-if="!hasCurrentPageEndReached && !chatListLoading" v-if="!hasCurrentPageEndReached && !chatListLoading"
class="clear button load-more-conversations" variant="clear"
size="expanded"
@click="fetchConversations" @click="fetchConversations"
> >
{{ $t('CHAT_LIST.LOAD_MORE_CONVERSATIONS') }} {{ $t('CHAT_LIST.LOAD_MORE_CONVERSATIONS') }}
</div> </woot-button>
<p <p
v-if=" v-if="
@ -217,7 +218,7 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '~dashboard/assets/scss/app.scss'; @import '~dashboard/assets/scss/woot';
.spinner { .spinner {
margin-top: var(--space-normal); margin-top: var(--space-normal);
margin-bottom: var(--space-normal); margin-bottom: var(--space-normal);

View file

@ -22,6 +22,8 @@
> >
<woot-button <woot-button
variant="clear" variant="clear"
size="small"
color-scheme="secondary"
class-names="status-change--dropdown-button" class-names="status-change--dropdown-button"
:is-disabled="status.disabled" :is-disabled="status.disabled"
@click="changeAvailabilityStatus(status.value)" @click="changeAvailabilityStatus(status.value)"

View file

@ -270,12 +270,6 @@ export default {
} }
} }
.change-accounts--button.button {
font-weight: $font-weight-normal;
font-size: $font-size-small;
padding: $space-small $space-one;
}
.account-selector { .account-selector {
cursor: pointer; cursor: pointer;
padding: $space-small $space-large; padding: $space-small $space-large;

View file

@ -7,30 +7,42 @@
> >
<woot-dropdown-menu> <woot-dropdown-menu>
<woot-dropdown-item v-if="showChangeAccountOption"> <woot-dropdown-item v-if="showChangeAccountOption">
<button <woot-button
class="button clear change-accounts--button" variant="clear"
size="small"
class=" change-accounts--button"
@click="$emit('toggle-accounts')" @click="$emit('toggle-accounts')"
> >
{{ $t('SIDEBAR_ITEMS.CHANGE_ACCOUNTS') }} {{ $t('SIDEBAR_ITEMS.CHANGE_ACCOUNTS') }}
</button> </woot-button>
</woot-dropdown-item> </woot-dropdown-item>
<woot-dropdown-item v-if="globalConfig.chatwootInboxToken"> <woot-dropdown-item v-if="globalConfig.chatwootInboxToken">
<button <woot-button
class="button clear change-accounts--button" variant="clear"
size="small"
class=" change-accounts--button"
@click="$emit('show-support-chat-window')" @click="$emit('show-support-chat-window')"
> >
Contact Support Contact Support
</button> </woot-button>
</woot-dropdown-item> </woot-dropdown-item>
<woot-dropdown-item> <woot-dropdown-item>
<router-link :to="`/app/accounts/${accountId}/profile/settings`"> <router-link
:to="`/app/accounts/${accountId}/profile/settings`"
class="button clear small change-accounts--button"
>
{{ $t('SIDEBAR_ITEMS.PROFILE_SETTINGS') }} {{ $t('SIDEBAR_ITEMS.PROFILE_SETTINGS') }}
</router-link> </router-link>
</woot-dropdown-item> </woot-dropdown-item>
<woot-dropdown-item> <woot-dropdown-item>
<a href="#" @click.prevent="logout"> <woot-button
variant="clear"
size="small"
class=" change-accounts--button"
@click="logout"
>
{{ $t('SIDEBAR_ITEMS.LOGOUT') }} {{ $t('SIDEBAR_ITEMS.LOGOUT') }}
</a> </woot-button>
</woot-dropdown-item> </woot-dropdown-item>
</woot-dropdown-menu> </woot-dropdown-menu>
</div> </div>

View file

@ -1,13 +1,7 @@
<template> <template>
<button <button
class="button" class="button"
:class="[ :class="buttonClasses"
variant,
size,
colorScheme,
classNames,
isDisabled ? 'disabled' : '',
]"
:disabled="isDisabled || isLoading" :disabled="isDisabled || isLoading"
@click="handleClick" @click="handleClick"
> >
@ -51,6 +45,28 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
isExpanded: {
type: Boolean,
default: false,
},
},
computed: {
variantClasses() {
if (this.variant.includes('link')) {
return `clear ${this.variant}`;
}
return this.variant;
},
buttonClasses() {
return [
this.variantClasses,
this.size,
this.colorScheme,
this.classNames,
this.isDisabled ? 'disabled' : '',
this.isExpanded ? 'expanded' : '',
];
},
}, },
methods: { methods: {
handleClick(evt) { handleClick(evt) {
@ -59,20 +75,3 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss" scoped>
.button {
display: flex;
align-items: center;
&.link {
padding: 0;
margin: 0;
}
}
.spinner {
padding: 0 var(--space-small);
}
.icon + .button__content {
padding-left: var(--space-small);
}
</style>

View file

@ -14,6 +14,8 @@
> >
<woot-button <woot-button
size="small" size="small"
variant="clear"
color-scheme="secondary"
class-names="goto-first" class-names="goto-first"
:is-disabled="hasFirstPage" :is-disabled="hasFirstPage"
@click="onFirstPage" @click="onFirstPage"
@ -23,16 +25,25 @@
</woot-button> </woot-button>
<woot-button <woot-button
size="small" size="small"
variant="clear"
color-scheme="secondary"
:is-disabled="hasPrevPage" :is-disabled="hasPrevPage"
@click="onPrevPage" @click="onPrevPage"
> >
<i class="ion-chevron-left" /> <i class="ion-chevron-left" />
</woot-button> </woot-button>
<woot-button @click.prevent> <woot-button
size="small"
variant="clear"
color-scheme="secondary"
@click.prevent
>
{{ currentPage }} {{ currentPage }}
</woot-button> </woot-button>
<woot-button <woot-button
size="small" size="small"
variant="clear"
color-scheme="secondary"
:is-disabled="hasNextPage" :is-disabled="hasNextPage"
@click="onNextPage" @click="onNextPage"
> >
@ -40,6 +51,8 @@
</woot-button> </woot-button>
<woot-button <woot-button
size="small" size="small"
variant="clear"
color-scheme="secondary"
class-names="goto-last" class-names="goto-last"
:is-disabled="hasLastPage" :is-disabled="hasLastPage"
@click="onLastPage" @click="onLastPage"
@ -147,52 +160,11 @@ export default {
.page-meta { .page-meta {
font-size: var(--font-size-mini); font-size: var(--font-size-mini);
} }
.pagination-button-group {
margin: 0;
.button { .goto-first,
background: transparent; .goto-last {
border-color: var(--color-border);
color: var(--color-body);
margin-bottom: 0;
margin-left: -2px;
font-size: var(--font-size-small);
padding: var(--space-small) var(--space-normal);
border-radius: 0;
&:hover,
&:focus,
&:active {
background: var(--s-200);
color: white;
}
&:first-child {
border-top-left-radius: var(--space-smaller);
border-bottom-left-radius: var(--space-smaller);
}
&:last-child {
border-top-right-radius: var(--space-smaller);
border-bottom-right-radius: var(--space-smaller);
}
&.small {
font-size: var(--font-size-micro);
}
&.disabled {
background: var(--s-200);
border-color: var(--s-200);
color: var(--b-900);
}
&.goto-first,
&.goto-last {
i:last-child { i:last-child {
margin-left: var(--space-minus-smaller); margin-left: var(--space-minus-smaller);
} }
}
}
} }
</style> </style>

View file

@ -75,7 +75,7 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '~dashboard/assets/scss/app.scss'; @import '~dashboard/assets/scss/woot';
.conversation-details-wrap { .conversation-details-wrap {
display: flex; display: flex;

View file

@ -12,8 +12,10 @@
<h3 class="user--name text-truncate"> <h3 class="user--name text-truncate">
{{ currentContact.name }} {{ currentContact.name }}
</h3> </h3>
<button <woot-button
class="user--profile__button clear button small" class="user--profile__button"
size="small"
variant="link"
@click="$emit('contact-panel-toggle')" @click="$emit('contact-panel-toggle')"
> >
{{ {{
@ -23,7 +25,7 @@
: $t('CONVERSATION.HEADER.OPEN') : $t('CONVERSATION.HEADER.OPEN')
} ${$t('CONVERSATION.HEADER.DETAILS')}` } ${$t('CONVERSATION.HEADER.DETAILS')}`
}} }}
</button> </woot-button>
</div> </div>
</div> </div>
<div <div

View file

@ -95,7 +95,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '~dashboard/assets/scss/app.scss'; @import '~dashboard/assets/scss/woot';
.right { .right {
.message-text--metadata { .message-text--metadata {

View file

@ -114,13 +114,12 @@ export default {
renderBodyCell: ({ row }) => ( renderBodyCell: ({ row }) => (
<woot-button <woot-button
variant="clear" variant="clear"
size="expanded"
onClick={() => this.onClickContact(row.id)} onClick={() => this.onClickContact(row.id)}
> >
<div class="row--user-block"> <div class="row--user-block">
<Thumbnail <Thumbnail
src={row.thumbnail} src={row.thumbnail}
size="36px" size="32px"
username={row.name} username={row.name}
status={row.availability_status} status={row.availability_status}
/> />
@ -128,7 +127,7 @@ export default {
<h6 class="sub-block-title user-name text-truncate"> <h6 class="sub-block-title user-name text-truncate">
{row.name} {row.name}
</h6> </h6>
<span class="button clear small"> <span class="button clear small link">
{this.$t('CONTACTS_PAGE.LIST.VIEW_DETAILS')} {this.$t('CONTACTS_PAGE.LIST.VIEW_DETAILS')}
</span> </span>
</div> </div>
@ -292,7 +291,7 @@ export default {
} }
.ve-table-body-td { .ve-table-body-td {
padding: var(--space-slab) var(--space-two) !important; padding: var(--space-small) var(--space-two) !important;
} }
.ve-table-header-th { .ve-table-header-th {

View file

@ -80,7 +80,7 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
padding: var(--space-small) var(--space-small) var(--space-small) padding: var(--space-small) var(--space-normal) var(--space-small)
var(--space-normal); var(--space-normal);
} }
@ -96,7 +96,6 @@ export default {
.search-wrap { .search-wrap {
width: 400px; width: 400px;
height: 3.8rem;
display: flex; display: flex;
align-items: center; align-items: center;
position: relative; position: relative;

View file

@ -7,14 +7,15 @@
$t('CONTACT_PANEL.NOT_AVAILABLE') $t('CONTACT_PANEL.NOT_AVAILABLE')
}}</span> }}</span>
<button <woot-button
v-if="showCopy" v-if="showCopy"
type="submit" type="submit"
class="button nice link hollow grey-btn compact" variant="link"
color-scheme="secondary"
icon="ion-clipboard"
class-names="icon copy-icon"
@click="onCopy" @click="onCopy"
> />
<i class="icon copy-icon ion-clipboard"></i>
</button>
</a> </a>
<div v-else class="contact-info--details"> <div v-else class="contact-info--details">
@ -85,9 +86,6 @@ export default {
.copy-icon { .copy-icon {
margin-left: $space-one; margin-left: $space-one;
&:hover {
color: $color-woot;
}
} }
&.a { &.a {

View file

@ -9,10 +9,12 @@
<router-link <router-link
v-if="showNewButton && isAdmin" v-if="showNewButton && isAdmin"
:to="buttonRoute" :to="buttonRoute"
class="button icon success nice button--fixed-right-top" class="button success button--fixed-right-top"
> >
<i class="icon ion-android-add-circle"></i> <i class="icon ion-android-add-circle"></i>
<span class="button__content">
{{ buttonText }} {{ buttonText }}
</span>
</router-link> </router-link>
</div> </div>
</template> </template>

View file

@ -44,10 +44,13 @@
</button> </button>
</div> </div>
<div class="medium-6 columns text-right"> <div class="medium-6 columns text-right">
<button class="button clear" @click.prevent="resetPassword"> <woot-button
<i class="ion-locked"></i> icon="ion-locked"
variant="clear"
@click.prevent="resetPassword"
>
{{ $t('AGENT_MGMT.EDIT.PASSWORD_RESET.ADMIN_RESET_BUTTON') }} {{ $t('AGENT_MGMT.EDIT.PASSWORD_RESET.ADMIN_RESET_BUTTON') }}
</button> </woot-button>
</div> </div>
</div> </div>
</form> </form>

View file

@ -1,13 +1,13 @@
<template> <template>
<div class="column content-box"> <div class="column content-box">
<button <woot-button
class="button nice icon success button--fixed-right-top" color-scheme="success"
class-names="button--fixed-right-top"
icon="ion-android-add-circle"
@click="openAddPopup()" @click="openAddPopup()"
> >
<i class="icon ion-android-add-circle"></i>
{{ $t('AGENT_MGMT.HEADER_BTN_TXT') }} {{ $t('AGENT_MGMT.HEADER_BTN_TXT') }}
</button> </woot-button>
<!-- Canned Response API Status -->
<!-- List Agents --> <!-- List Agents -->
<div class="row"> <div class="row">
@ -55,21 +55,27 @@
<!-- Actions --> <!-- Actions -->
<td> <td>
<div class="button-wrapper"> <div class="button-wrapper">
<woot-submit-button <woot-button
v-if="showEditAction(agent)" v-if="showEditAction(agent)"
:button-text="$t('AGENT_MGMT.EDIT.BUTTON_TEXT')" variant="link"
icon-class="ion-edit" color-scheme="secondary"
button-class="link hollow grey-btn" icon="ion-edit"
class-names="grey-btn"
@click="openEditPopup(agent)" @click="openEditPopup(agent)"
/> >
<woot-submit-button {{ $t('AGENT_MGMT.EDIT.BUTTON_TEXT') }}
</woot-button>
<woot-button
v-if="showDeleteAction(agent)" v-if="showDeleteAction(agent)"
:button-text="$t('AGENT_MGMT.DELETE.BUTTON_TEXT')" variant="link"
:loading="loading[agent.id]" color-scheme="secondary"
icon-class="ion-close-circled" icon="ion-close-circled"
button-class="link hollow grey-btn" class-names="grey-btn"
:is-loading="loading[agent.id]"
@click="openDeletePopup(agent, index)" @click="openDeletePopup(agent, index)"
/> >
{{ $t('AGENT_MGMT.DELETE.BUTTON_TEXT') }}
</woot-button>
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -1,12 +1,14 @@
<template> <template>
<div class="column content-box"> <div class="column content-box">
<button <woot-button
class="button nice icon success button--fixed-right-top" color-scheme="success"
class-names="button--fixed-right-top"
icon="ion-android-add-circle"
@click="openAddPopup()" @click="openAddPopup()"
> >
<i class="icon ion-android-add-circle"></i>
{{ $t('CANNED_MGMT.HEADER_BTN_TXT') }} {{ $t('CANNED_MGMT.HEADER_BTN_TXT') }}
</button> </woot-button>
<!-- List Canned Response --> <!-- List Canned Response -->
<div class="row"> <div class="row">
<div class="small-8 columns"> <div class="small-8 columns">
@ -47,21 +49,25 @@
<td>{{ cannedItem.content }}</td> <td>{{ cannedItem.content }}</td>
<!-- Action Buttons --> <!-- Action Buttons -->
<td class="button-wrapper"> <td class="button-wrapper">
<div @click="openEditPopup(cannedItem)"> <woot-button
<woot-submit-button variant="link"
:button-text="$t('CANNED_MGMT.EDIT.BUTTON_TEXT')" color-scheme="secondary"
icon-class="ion-edit" icon="ion-edit"
button-class="link hollow grey-btn" class-names="grey-btn"
/> @click="openEditPopup(cannedItem)"
</div> >
<div @click="openDeletePopup(cannedItem, index)"> {{ $t('CANNED_MGMT.EDIT.BUTTON_TEXT') }}
<woot-submit-button </woot-button>
:button-text="$t('CANNED_MGMT.DELETE.BUTTON_TEXT')" <woot-button
:loading="loading[cannedItem.id]" variant="link"
icon-class="ion-close-circled" color-scheme="secondary"
button-class="link hollow grey-btn" icon="ion-close-circled"
/> class-names="grey-btn"
</div> :is-loading="loading[cannedItem.id]"
@click="openDeletePopup(cannedItem, index)"
>
{{ $t('CANNED_MGMT.DELETE.BUTTON_TEXT') }}
</woot-button>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View file

@ -59,22 +59,28 @@
<router-link <router-link
:to="addAccountScoping(`settings/inboxes/${item.id}`)" :to="addAccountScoping(`settings/inboxes/${item.id}`)"
> >
<woot-submit-button <woot-button
v-if="isAdmin" v-if="isAdmin"
:button-text="$t('INBOX_MGMT.SETTINGS')" icon="ion-gear-b"
icon-class="ion-gear-b" variant="link"
button-class="link hollow grey-btn" color-scheme="secondary"
/> class-names="grey-btn"
>
{{ $t('INBOX_MGMT.SETTINGS') }}
</woot-button>
</router-link> </router-link>
<woot-submit-button <woot-button
v-if="isAdmin" v-if="isAdmin"
:button-text="$t('INBOX_MGMT.DELETE.BUTTON_TEXT')" variant="link"
:loading="loading[item.id]" color-scheme="secondary"
icon-class="ion-close-circled" class-names="grey-btn"
button-class="link hollow grey-btn" :is-loading="loading[item.id]"
icon="ion-close-circled"
@click="openDelete(item)" @click="openDelete(item)"
/> >
{{ $t('INBOX_MGMT.DELETE.BUTTON_TEXT') }}
</woot-button>
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -133,13 +133,13 @@ export default {
key: 'buttons', key: 'buttons',
title: '', title: '',
align: 'left', align: 'left',
renderBodyCell: (row) => ( renderBodyCell: row => (
<div class="button-wrapper"> <div class="button-wrapper">
<WootButton <WootButton
variant="clear" variant="clear"
icon="ion-edit" icon="ion-edit"
color-scheme="secondary" color-scheme="secondary"
classNames="hollow grey-btn" classNames="grey-btn"
onClick={() => this.onEditClick(row)} onClick={() => this.onEditClick(row)}
> >
{this.$t('CAMPAIGN.LIST.BUTTONS.EDIT')} {this.$t('CAMPAIGN.LIST.BUTTONS.EDIT')}
@ -155,7 +155,7 @@ export default {
if (this.isLoading) { if (this.isLoading) {
return []; return [];
} }
return this.campaigns.map((item) => { return this.campaigns.map(item => {
return { return {
...item, ...item,
url: item.trigger_rules.url, url: item.trigger_rules.url,

View file

@ -1,12 +1,14 @@
<template> <template>
<div class="row content-box full-height"> <div class="row content-box full-height">
<button <woot-button
class="button nice icon success button--fixed-right-top" color-scheme="success"
class-names="button--fixed-right-top"
icon="ion-android-add-circle"
@click="openAddPopup()" @click="openAddPopup()"
> >
<i class="icon ion-android-add-circle"></i>
{{ $t('INTEGRATION_SETTINGS.WEBHOOK.HEADER_BTN_TXT') }} {{ $t('INTEGRATION_SETTINGS.WEBHOOK.HEADER_BTN_TXT') }}
</button> </woot-button>
<div class="row"> <div class="row">
<div class="small-8 columns"> <div class="small-8 columns">
<p <p

View file

@ -1,12 +1,13 @@
<template> <template>
<div class="column content-box"> <div class="column content-box">
<button <woot-button
class="button nice icon success button--fixed-right-top" color-scheme="success"
class-names="button--fixed-right-top"
icon="ion-android-add-circle"
@click="openAddPopup" @click="openAddPopup"
> >
<i class="icon ion-android-add-circle"></i>
{{ $t('LABEL_MGMT.HEADER_BTN_TXT') }} {{ $t('LABEL_MGMT.HEADER_BTN_TXT') }}
</button> </woot-button>
<div class="row"> <div class="row">
<div class="small-8 columns"> <div class="small-8 columns">
<p <p
@ -42,20 +43,26 @@
</div> </div>
</td> </td>
<td class="button-wrapper"> <td class="button-wrapper">
<woot-submit-button <woot-button
:button-text="$t('LABEL_MGMT.FORM.EDIT')" variant="link"
icon-class="ion-edit" color-scheme="secondary"
button-class="link hollow grey-btn" class-names="grey-btn"
:is-loading="loading[label.id]"
icon="ion-edit"
@click="openEditPopup(label)" @click="openEditPopup(label)"
/> >
{{ $t('LABEL_MGMT.FORM.EDIT') }}
<woot-submit-button </woot-button>
:button-text="$t('LABEL_MGMT.FORM.DELETE')" <woot-button
:loading="loading[label.id]" variant="link"
icon-class="ion-close-circled" color-scheme="secondary"
button-class="link hollow grey-btn" icon="ion-close-circled"
class-names="grey-btn"
:is-loading="loading[label.id]"
@click="openDeletePopup(label, index)" @click="openDeletePopup(label, index)"
/> >
{{ $t('LABEL_MGMT.FORM.DELETE') }}
</woot-button>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View file

@ -1,12 +1,13 @@
<template> <template>
<div class="column content-box"> <div class="column content-box">
<button <woot-button
class="button nice icon success button--fixed-right-top" color-scheme="success"
class-names="button--fixed-right-top"
icon="ion-android-download"
@click="downloadAgentReports" @click="downloadAgentReports"
> >
<i class="icon ion-android-download"></i>
{{ $t('REPORT.DOWNLOAD_AGENT_REPORTS') }} {{ $t('REPORT.DOWNLOAD_AGENT_REPORTS') }}
</button> </woot-button>
<div class="small-3 pull-right"> <div class="small-3 pull-right">
<multiselect <multiselect
v-model="currentDateRangeSelection" v-model="currentDateRangeSelection"

View file

@ -25,22 +25,27 @@
<router-link <router-link
:to="addAccountScoping(`settings/teams/${item.id}/edit`)" :to="addAccountScoping(`settings/teams/${item.id}/edit`)"
> >
<woot-submit-button <woot-button
v-if="isAdmin" v-if="isAdmin"
:button-text="$t('TEAMS_SETTINGS.LIST.EDIT_TEAM')" variant="link"
icon-class="ion-gear-b" color-scheme="secondary"
button-class="link hollow grey-btn" class-names="grey-btn"
/> icon="ion-gear-b"
>
{{ $t('TEAMS_SETTINGS.LIST.EDIT_TEAM') }}
</woot-button>
</router-link> </router-link>
<woot-button
<woot-submit-button
v-if="isAdmin" v-if="isAdmin"
:button-text="$t('TEAMS_SETTINGS.DELETE.BUTTON_TEXT')" variant="link"
:loading="loading[item.id]" color-scheme="secondary"
icon-class="ion-close-circled" icon="ion-close-circled"
button-class="link hollow grey-btn" class-names="grey-btn"
:is-loading="loading[item.id]"
@click="openDelete(item)" @click="openDelete(item)"
/> >
{{ $t('TEAMS_SETTINGS.DELETE.BUTTON_TEXT') }}
</woot-button>
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -36,11 +36,11 @@ export default {
width: 100%; width: 100%;
text-align: left; text-align: left;
white-space: nowrap; white-space: nowrap;
padding: var(--space-small) var(--space-one); display: inline-flex;
border-radius: var(--border-radius-normal);
&:hover { &:hover {
background: var(--color-background); background: var(--color-background);
border-radius: var(--border-radius-normal);
} }
} }
} }

View file

@ -0,0 +1,185 @@
import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
import WootButton from '../../app/javascript/dashboard/components/ui/WootButton.vue';
<Meta title="Styleguide/Buttons" />
# Buttons
Buttons can be used by `woot-button` component in `vue`. You can play with all the props here 👉 [woot-button](/story/components-button--primary). The button component is made on top of [foundation button](https://get.foundation/sites/docs/button.html)
so the style of button can be used outside of vue with `button` class.
Other than declred props the `woot-button` can be customised by providing custom classnames through `class-names` prop.
<Story name="default">
{{
template: `<woot-button size="" title="Press me">Default</woot-button>`,
}}
</Story>
- While naming button labels make sure to describe the action with some context.
- For HTML forms use `<woot-button type="submit">` instead of `<input type="submit" />`
- Provide title or tooltip if possible.
## Button sizes
Size of the buttons can be set with `size` to `woot-button`. By default medium is the default size of a button. Other sizes are `tiny, small, medium, large`.
<Canvas>
<Story name="sizes">
{{
template: `<div class="row">
<div class="margin-horizontal-2">
<woot-button size="tiny">Tiny</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button size="small">Small</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button size="">Default</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button size="large">Large</woot-button>
</div>
</div>`,
}}
</Story>
</Canvas>
Buttons can expanded to full width by setting the `is-expanded` prop. For with by screen size or to make it responsive try with the classnames on
[Responsive Expanded buttons](https://get.foundation/sites/docs/button.html#responsive-expanded-buttons) with foundation.
<Canvas>
<Story name="expanded">
{{
template: `<div class="row">
<div class="columns">
<woot-button size="large" is-expanded title="Micheal Scott said the rest">This is buttons is very long</woot-button>
</div>
</div>`,
}}
</Story>
</Canvas>
## Button colors
Chatwoot comes with predefined set of colors for buttons. The color of the button can be set with `color-scheme` to `woot-button`.
Default color scheme is `primary`, other color-schemes are `secondary, success, alert, warning`.
<Canvas>
<Story name="colors">
{{
template: `<div class="row">
<div class="margin-horizontal-2">
<woot-button >Primary</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button color-scheme="secondary">Secondary</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button color-scheme="success">Success</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button color-scheme="alert">Alert</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button color-scheme="warning">Warning</woot-button>
</div>
</div>`,
}}
</Story>
</Canvas>
## Button style variations
There are diffrent styles that comes with chatwoot buttons. This can set with `variants` prop for `woot-button`. By deault the filled will be the style, other variations are `smooth, hollow, clear, link`
- Primary form actions like Save details, Create campaign etc should use default style.
- The Cancel action has to use the smooth style.
<Canvas>
<Story name="variants">
{{
template: `<div class="row">
<div class="margin-horizontal-2">
<woot-button >Default</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button variant="smooth" color-scheme="alert">Smooth</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button color-scheme="secondary" variant="hollow">Hollow</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button color-scheme="success" variant="clear">Success</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button color-scheme="alert" variant="link">Link</woot-button>
</div>
</div>`,
}}
</Story>
</Canvas>
## Button states
The button can be disbaled with `is-disabled` which accepts a boolean value. The button can set to a loading state with `is-loading` which accepts a boolean value.
These are states other than the default interaction states like hover, active, focused.
<Canvas>
<Story name="states">
{{
template: `<div class="row">
<div class="margin-horizontal-2">
<woot-button color-scheme="alert" is-disabled>disabled :/</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button variant="smooth" color-scheme="primary" is-loading>Loading...</woot-button>
</div>
</div>`,
}}
</Story>
</Canvas>
## Button with icon and text
Chatwoot currently use [IonIcons version 2](https://ionic.io/ionicons/v2) which are font-icons. The button position is fixed on the left.
The prop `icon` can be used to pass the **ion icon classname** to render the icon.
<Canvas>
<Story name="icons">
{{
template: `<div class="row">
<div class="margin-horizontal-2">
<woot-button color-scheme="alert" icon="ion-stop">Stop</woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button icon="ion-person" variant="hollow">Hollow man</woot-button>
</div>
</div>`,
}}
</Story>
</Canvas>
#### Buttons with only icon
The `woot-button` can be used as an icon only button by keeping the button text empty.
<Canvas>
<Story name="icononly">
{{
template: `<div class="row">
<div class="margin-horizontal-2">
<woot-button color-scheme="success" icon="ion-plus" size="tiny"></woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button color-scheme="secondary" icon="ion-plus" size="small" variant="smooth"></woot-button>
</div>
<div class="margin-horizontal-2">
<woot-button icon="ion-plus" variant="hollow"></woot-button>
</div>
</div>`,
}}
</Story>
</Canvas>