From 3a89661c663998b1de440f3f9925564434b43f2e Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Fri, 22 Mar 2024 17:44:29 +0100 Subject: [PATCH] fix(Switch): improve sizes --- playground/pages/switch.vue | 4 +-- src/theme/switch.ts | 23 +++--------- .../__snapshots__/Switch.spec.ts.snap | 36 +++++++++---------- 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/playground/pages/switch.vue b/playground/pages/switch.vue index fe2ff039..162bfa66 100644 --- a/playground/pages/switch.vue +++ b/playground/pages/switch.vue @@ -13,10 +13,10 @@ const checked = ref(false)
-
+
-
+
({ icon: `group-data-[state=checked]:text-${color}-500 dark:group-data-[state=checked]:text-${color}-400` }])), size: { - '2xs': { - root: 'h-3 w-5', - thumb: 'size-2 data-[state=checked]:translate-x-2', - icon: 'size-1.5' - }, xs: { - root: 'h-3.5 w-6', - thumb: 'size-2.5 data-[state=checked]:translate-x-2.5', - icon: 'size-2' - }, - sm: { root: 'h-4 w-7', thumb: 'size-3 data-[state=checked]:translate-x-3', icon: 'size-2.5' }, - md: { + sm: { root: 'h-5 w-9', thumb: 'size-4 data-[state=checked]:translate-x-4', icon: 'size-3' }, - lg: { + md: { root: 'h-6 w-11', thumb: 'size-5 data-[state=checked]:translate-x-5', icon: 'size-4' }, - xl: { + lg: { root: 'h-7 w-[3.25rem]', thumb: 'size-6 data-[state=checked]:translate-x-6', icon: 'size-5' - }, - '2xl': { - root: 'h-8 w-[3.75rem]', - thumb: 'size-7 data-[state=checked]:translate-x-7', - icon: 'size-6' } }, checked: { @@ -57,6 +42,6 @@ export default (config: { colors: string[] }) => ({ }, defaultVariants: { color: 'primary', - size: 'md' + size: 'sm' } }) diff --git a/test/components/__snapshots__/Switch.spec.ts.snap b/test/components/__snapshots__/Switch.spec.ts.snap index 53f0fab4..356955cc 100644 --- a/test/components/__snapshots__/Switch.spec.ts.snap +++ b/test/components/__snapshots__/Switch.spec.ts.snap @@ -46,37 +46,37 @@ exports[`Switch > renders with required correctly 1`] = ` `; exports[`Switch > renders with size 2xl correctly 1`] = ` -" +" " `; exports[`Switch > renders with size 2xs correctly 1`] = ` -" +" " `; exports[`Switch > renders with size lg correctly 1`] = ` -" -" -`; - -exports[`Switch > renders with size md correctly 1`] = ` -" -" -`; - -exports[`Switch > renders with size sm correctly 1`] = ` -" -" -`; - -exports[`Switch > renders with size xl correctly 1`] = ` " " `; +exports[`Switch > renders with size md correctly 1`] = ` +" +" +`; + +exports[`Switch > renders with size sm correctly 1`] = ` +" +" +`; + +exports[`Switch > renders with size xl correctly 1`] = ` +" +" +`; + exports[`Switch > renders with size xs correctly 1`] = ` -" +" " `;