mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-31 19:17:48 +00:00
# Pull Request Template ## Description Fixes https://linear.app/chatwoot/issue/CW-4091/accessibility-improvement-support-bigger-font-size-for-the-dashboard ## Type of change - [x] New feature (non-breaking change which adds functionality) ## How Has This Been Tested? ### **Loom video** https://www.loom.com/share/1ab781859fa748a5ad54aacbacd127b4?sid=a7dd9164-a6de-462f-bff7-1b25e9c55b4f ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
85 lines
2.0 KiB
Vue
85 lines
2.0 KiB
Vue
<script>
|
|
export default {
|
|
props: {
|
|
modelValue: { type: Boolean, default: false },
|
|
size: { type: String, default: '' },
|
|
},
|
|
emits: ['update:modelValue', 'input'],
|
|
methods: {
|
|
onClick() {
|
|
this.$emit('update:modelValue', !this.modelValue);
|
|
this.$emit('input', !this.modelValue);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<button
|
|
type="button"
|
|
class="toggle-button p-0"
|
|
:class="{ active: modelValue, small: size === 'small' }"
|
|
role="switch"
|
|
:aria-checked="modelValue.toString()"
|
|
@click="onClick"
|
|
>
|
|
<span aria-hidden="true" :class="{ active: modelValue }" />
|
|
</button>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
.toggle-button {
|
|
@apply bg-slate-200 dark:bg-slate-600;
|
|
--toggle-button-box-shadow: rgb(255, 255, 255) 0px 0px 0px 0px,
|
|
rgba(59, 130, 246, 0.5) 0px 0px 0px 0px, rgba(0, 0, 0, 0.1) 0px 1px 3px 0px,
|
|
rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
|
|
border-radius: var(--border-radius-large);
|
|
border: 2px solid transparent;
|
|
cursor: pointer;
|
|
display: flex;
|
|
flex-shrink: 0;
|
|
height: 1.188rem;
|
|
position: relative;
|
|
transition-duration: 200ms;
|
|
transition-property: background-color;
|
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
width: 2.125rem;
|
|
|
|
&.active {
|
|
background-color: var(--w-500);
|
|
}
|
|
|
|
&.small {
|
|
width: 1.375rem;
|
|
height: 0.875rem;
|
|
|
|
span {
|
|
height: var(--space-one);
|
|
width: var(--space-one);
|
|
|
|
&.active {
|
|
transform: translate(var(--space-small), var(--space-zero));
|
|
}
|
|
}
|
|
}
|
|
|
|
span {
|
|
@apply bg-white dark:bg-slate-900;
|
|
--space-one-point-five: 0.9375rem;
|
|
border-radius: 100%;
|
|
box-shadow: var(--toggle-button-box-shadow);
|
|
display: inline-block;
|
|
height: var(--space-one-point-five);
|
|
transform: translate(0, 0);
|
|
transition-duration: 200ms;
|
|
transition-property: transform;
|
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
width: var(--space-one-point-five);
|
|
|
|
&.active {
|
|
transform: translate(var(--space-one-point-five), var(--space-zero));
|
|
}
|
|
}
|
|
}
|
|
</style>
|