Skip to content

Commit

Permalink
fix(switch): prevent selecting text on double click
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki committed Nov 27, 2022
1 parent 6f9c6de commit 5253c6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/anu-vue/src/components/switch/ASwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const ASwitch = defineComponent({
return () => (
<label
class={[
'a-switch',
props.label || slots.default
? 'flex'
: 'inline-flex', 'a-switch cursor-pointer uno-layer-base-rounded-full justify-between items-center',
Expand All @@ -82,7 +83,9 @@ export const ASwitch = defineComponent({
/>

{/* 馃憠 Label */}
{slots.default ? slots.default() : props.label}
<div class="a-switch-label">
{slots.default ? slots.default() : props.label}
</div>

{/* 馃憠 Switch */}
{/* min width should be double the dot size */}
Expand Down
2 changes: 2 additions & 0 deletions packages/anu-vue/src/presets/theme-default/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ const themeShortcuts: Exclude<Preset['shortcuts'], undefined> = [
'a-select-option': 'em:spacing:px-4 em:spacing:py-1',

// 馃憠 Switch
'a-switch': 'select-none',
'a-switch-label': 'select-text',
'a-switch-toggle': 'transition-colors transition-duration-100 ease-in-out',
'a-switch-dot': 'h-[1.18em] w-[1.18em] bg-white transition transition-duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]',
'a-switch-icon': 'em:text-xs',
Expand Down

0 comments on commit 5253c6a

Please sign in to comment.