Chore: Hover color for status dropdown (#1906)

This commit is contained in:
Sivin Varghese 2021-03-20 13:08:56 +05:30 committed by GitHub
parent 6afa1fb556
commit e289106c5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 190 additions and 149 deletions

View file

@ -54,8 +54,10 @@
opacity: 0; opacity: 0;
} }
.menu-slide-enter-active, .menu-slide-leave-active { .menu-slide-enter-active,
transition: all .15s $ease-in-cubic; .menu-slide-leave-active {
transform: translateY(0);
transition: transform 0.25s $ease-in-cubic, opacity 0.15s $ease-in-cubic;
} }
.menu-slide-enter, .menu-slide-leave-to .menu-slide-enter, .menu-slide-leave-to

View file

@ -1,27 +1,42 @@
.dropdown-pane.sleek { .dropdown-pane {
@include elegant-card; @include elegant-card;
@include border-light; @include border-light;
padding-left: 0; z-index: 999;
padding-right: 0;
right: -12px;
top: 48px;
width: auto;
&::before { &.dropdown-pane--open {
@include arrow(top, var(--color-border-light), 14px); display: block;
position: absolute; visibility: visible;
right: 6px;
top: -14px;
} }
&::after { &.dropdowm--bottom {
@include arrow(top, $color-white, var(--space-slab)); &::before {
position: absolute; @include arrow(top, var(--color-border-light), 14px);
right: var(--space-small); position: absolute;
top: -12px; right: 6px;
top: -14px;
}
&::after {
@include arrow(top, $color-white, var(--space-slab));
position: absolute;
right: var(--space-small);
top: -12px;
}
} }
.dropdown>li>a:hover { &.dropdowm--top {
background: var(--color-background); &::before {
@include arrow(bottom, var(--color-border-light), 14px);
bottom: -14px;
position: absolute;
right: 6px;
}
&::after {
@include arrow(bottom, $color-white, var(--space-slab));
bottom: -12px;
position: absolute;
right: var(--space-small);
}
} }
} }

View file

@ -68,21 +68,11 @@
position: relative; position: relative;
.dropdown-pane { .dropdown-pane {
@include elegant-card;
@include border-light;
bottom: 6rem; bottom: 6rem;
display: block; display: block;
left: 5rem; left: 5rem;
visibility: visible; visibility: visible;
width: 80%; width: 80%;
z-index: 999;
&::before {
@include arrow(bottom, $color-white, $space-slab);
bottom: -$space-slab;
position: absolute;
right: $space-slab;
}
} }
.active { .active {

View file

@ -15,25 +15,24 @@
<div <div
v-if="isStatusMenuOpened" v-if="isStatusMenuOpened"
v-on-clickaway="closeStatusMenu" v-on-clickaway="closeStatusMenu"
class="dropdown-pane top" class="dropdown-pane dropdowm--top"
> >
<ul class="vertical dropdown menu"> <woot-dropdown-menu>
<li <woot-dropdown-item
v-for="status in availabilityStatuses" v-for="status in availabilityStatuses"
:key="status.value" :key="status.value"
class="status-items" class="status-items"
> >
<div :class="`status-badge status-badge__${status.value}`" />
<button <button
class="button clear status-change--dropdown-button" class="button clear status-change--dropdown-button"
:disabled="status.disabled" :disabled="status.disabled"
@click="changeAvailabilityStatus(status.value)" @click="changeAvailabilityStatus(status.value)"
> >
<span :class="`status-badge status-badge__${status.value}`" />
{{ status.label }} {{ status.label }}
</button> </button>
</li> </woot-dropdown-item>
</ul> </woot-dropdown-menu>
</div> </div>
</transition> </transition>
@ -47,9 +46,17 @@
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { mixin as clickaway } from 'vue-clickaway'; import { mixin as clickaway } from 'vue-clickaway';
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem.vue';
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu.vue';
const AVAILABILITY_STATUS_KEYS = ['online', 'busy', 'offline']; const AVAILABILITY_STATUS_KEYS = ['online', 'busy', 'offline'];
export default { export default {
components: {
WootDropdownMenu,
WootDropdownItem,
},
mixins: [clickaway], mixins: [clickaway],
data() { data() {
@ -121,7 +128,7 @@ export default {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: $space-micro $space-smaller; padding: var(--space-micro) var(--space-smaller);
} }
.status-view { .status-view {
@ -129,10 +136,10 @@ export default {
align-items: baseline; align-items: baseline;
& &--title { & &--title {
color: $color-gray; color: var(--b-600);
font-size: $font-size-small; font-size: var(--font-size-small);
font-weight: $font-weight-medium; font-weight: var(--font-weight-medium);
margin-left: $space-small; margin-left: var(--space-small);
&:first-letter { &:first-letter {
text-transform: capitalize; text-transform: capitalize;
@ -140,51 +147,44 @@ export default {
} }
} }
.status-badge {
width: var(--space-one);
height: var(--space-one);
margin-right: var(--space-micro);
display: inline-block;
border-radius: 50%;
&__online {
background: var(--g-400);
}
&__offline {
background: var(--b-600);
}
&__busy {
background: var(--y-700);
}
}
.status-change { .status-change {
.dropdown-pane { .dropdown-pane {
top: -130px; top: -132px;
} }
.status-items { .status-items {
display: flex; display: flex;
align-items: baseline; align-items: baseline;
} }
& &--change-button { & &--change-button {
color: $color-gray; color: var(--b-600);
font-size: $font-size-small; font-size: var(--font-size-small);
border-bottom: 1px solid $color-gray;
cursor: pointer; cursor: pointer;
outline: none;
&:hover { &:hover {
border-bottom: none; color: var(--w-600);
} }
} }
& &--dropdown-button {
font-weight: $font-weight-normal;
font-size: $font-size-small;
padding: $space-small $space-one;
text-align: left;
width: 100%;
}
}
.status-badge {
width: $space-one;
height: $space-one;
border-radius: 50%;
&__online {
background: $success-color;
}
&__offline {
background: $color-gray;
}
&__busy {
background: $warning-color;
}
} }
</style> </style>

View file

@ -270,14 +270,6 @@ export default {
padding: $space-small $space-one; padding: $space-small $space-one;
} }
.dropdown-pane {
li {
a {
padding: $space-small $space-one !important;
}
}
}
.account-selector { .account-selector {
cursor: pointer; cursor: pointer;
padding: $space-small $space-large; padding: $space-small $space-large;

View file

@ -3,36 +3,36 @@
<div <div
v-if="show" v-if="show"
v-on-clickaway="() => $emit('close')" v-on-clickaway="() => $emit('close')"
class="dropdown-pane top" class="dropdown-pane dropdowm--top"
> >
<ul class="vertical dropdown menu"> <woot-dropdown-menu>
<li v-if="showChangeAccountOption"> <woot-dropdown-item v-if="showChangeAccountOption">
<button <button
class="button clear change-accounts--button" class="button clear change-accounts--button"
@click="$emit('toggle-accounts')" @click="$emit('toggle-accounts')"
> >
{{ $t('SIDEBAR_ITEMS.CHANGE_ACCOUNTS') }} {{ $t('SIDEBAR_ITEMS.CHANGE_ACCOUNTS') }}
</button> </button>
</li> </woot-dropdown-item>
<li v-if="globalConfig.chatwootInboxToken"> <woot-dropdown-item v-if="globalConfig.chatwootInboxToken">
<button <button
class="button clear change-accounts--button" class="button clear change-accounts--button"
@click="$emit('show-support-chat-window')" @click="$emit('show-support-chat-window')"
> >
Contact Support Contact Support
</button> </button>
</li> </woot-dropdown-item>
<li> <woot-dropdown-item>
<router-link :to="`/app/accounts/${accountId}/profile/settings`"> <router-link :to="`/app/accounts/${accountId}/profile/settings`">
{{ $t('SIDEBAR_ITEMS.PROFILE_SETTINGS') }} {{ $t('SIDEBAR_ITEMS.PROFILE_SETTINGS') }}
</router-link> </router-link>
</li> </woot-dropdown-item>
<li> <woot-dropdown-item>
<a href="#" @click.prevent="logout"> <a href="#" @click.prevent="logout">
{{ $t('SIDEBAR_ITEMS.LOGOUT') }} {{ $t('SIDEBAR_ITEMS.LOGOUT') }}
</a> </a>
</li> </woot-dropdown-item>
</ul> </woot-dropdown-menu>
</div> </div>
</transition> </transition>
</template> </template>
@ -41,8 +41,14 @@
import { mixin as clickaway } from 'vue-clickaway'; import { mixin as clickaway } from 'vue-clickaway';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import Auth from '../../../api/auth'; import Auth from '../../../api/auth';
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem.vue';
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu.vue';
export default { export default {
components: {
WootDropdownMenu,
WootDropdownItem,
},
mixins: [clickaway], mixins: [clickaway],
props: { props: {
show: { show: {

View file

@ -12,31 +12,26 @@
<div <div
v-if="showConversationActions" v-if="showConversationActions"
v-on-clickaway="hideConversationActions" v-on-clickaway="hideConversationActions"
class="dropdown-pane" class="dropdown-pane dropdowm--bottom"
:class="{ 'dropdown-pane--open': showConversationActions }" :class="{ 'dropdown-pane--open': showConversationActions }"
> >
<button <woot-dropdown-menu>
v-if="!currentChat.muted" <woot-dropdown-item v-if="!currentChat.muted">
class="button small clear row alert small-6 action--button" <button class="button clear alert " @click="mute">
@click="mute" <span>{{ $t('CONTACT_PANEL.MUTE_CONTACT') }}</span>
> </button>
<span>{{ $t('CONTACT_PANEL.MUTE_CONTACT') }}</span> </woot-dropdown-item>
</button> <woot-dropdown-item v-else>
<button class="button clear alert" @click="unmute">
<button <span>{{ $t('CONTACT_PANEL.UNMUTE_CONTACT') }}</span>
v-else </button>
class="button small clear row alert small-6 action--button" </woot-dropdown-item>
@click="unmute" <woot-dropdown-item>
> <button class="button clear" @click="toggleEmailActionsModal">
<span>{{ $t('CONTACT_PANEL.UNMUTE_CONTACT') }}</span> {{ $t('CONTACT_PANEL.SEND_TRANSCRIPT') }}
</button> </button>
</woot-dropdown-item>
<button </woot-dropdown-menu>
class="button small clear row small-6 action--button"
@click="toggleEmailActionsModal"
>
{{ $t('CONTACT_PANEL.SEND_TRANSCRIPT') }}
</button>
</div> </div>
<email-transcript-modal <email-transcript-modal
v-if="showEmailActionsModal" v-if="showEmailActionsModal"
@ -52,9 +47,13 @@ import { mixin as clickaway } from 'vue-clickaway';
import alertMixin from 'shared/mixins/alertMixin'; import alertMixin from 'shared/mixins/alertMixin';
import EmailTranscriptModal from './EmailTranscriptModal'; import EmailTranscriptModal from './EmailTranscriptModal';
import ResolveAction from '../../buttons/ResolveAction'; import ResolveAction from '../../buttons/ResolveAction';
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem.vue';
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu.vue';
export default { export default {
components: { components: {
WootDropdownMenu,
WootDropdownItem,
EmailTranscriptModal, EmailTranscriptModal,
ResolveAction, ResolveAction,
}, },
@ -117,43 +116,13 @@ export default {
} }
.dropdown-pane { .dropdown-pane {
@include elegant-card;
@include border-light;
right: -12px; right: -12px;
top: 48px; top: 48px;
width: auto; width: auto;
&::before {
@include arrow(top, var(--color-border-light), 14px);
top: -14px;
position: absolute;
right: 6px;
}
&::after {
@include arrow(top, white, var(--space-slab));
top: -12px;
position: absolute;
right: var(--space-small);
}
} }
.dropdown-pane--open { .icon {
display: block; margin-right: var(--space-smaller);
visibility: visible; min-width: var(--space-normal);
}
.action--button {
display: flex;
align-items: center;
width: 100%;
white-space: nowrap;
padding: var(--space-small) var(--space-smaller);
font-size: var(--font-size-small);
.icon {
margin-right: var(--space-smaller);
min-width: var(--space-normal);
}
} }
</style> </style>

View file

@ -0,0 +1,46 @@
<template>
<li
class="dropdown-menu__item"
:class="{
'is-disabled': disabled,
}"
:tabindex="disabled ? null : -1"
:aria-disabled="disabled"
>
<slot></slot>
</li>
</template>
<script>
export default {
name: 'WootDropdownItem',
componentName: 'WootDropdownMenu',
props: {
disabled: {
type: Boolean,
default: false,
},
className: {
type: String,
default: '',
},
},
};
</script>
<style lang="scss" scoped>
.dropdown-menu__item ::v-deep {
a,
.button {
font-weight: var(--font-size-normal);
font-size: var(--font-size-small);
width: 100%;
text-align: left;
white-space: nowrap;
padding: var(--space-small) var(--space-one);
&:hover {
background: var(--color-background);
border-radius: var(--border-radius-normal);
}
}
}
</style>

View file

@ -0,0 +1,21 @@
<template>
<ul
class="dropdown menu vertical"
:class="[placement && `dropdown--${placement}`]"
>
<slot></slot>
</ul>
</template>
<script>
export default {
name: 'WootDropdownMenu',
componentName: 'WootDropdownMenu',
props: {
placement: {
type: String,
default: 'top',
},
},
};
</script>