From f97d2e3b88d1ba9be5f7e2916c6502e38ac4d4c1 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Fri, 13 Dec 2024 11:35:35 +0100 Subject: [PATCH] fix(Badge): reduce radius on `sm` size --- src/theme/badge.ts | 8 +-- src/theme/navigation-menu.ts | 2 +- .../__snapshots__/Badge.spec.ts.snap | 50 +++++++++---------- .../__snapshots__/NavigationMenu.spec.ts.snap | 44 ++++++++-------- .../__snapshots__/Table.spec.ts.snap | 10 ++-- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/theme/badge.ts b/src/theme/badge.ts index 2741ded9..6b7ff651 100644 --- a/src/theme/badge.ts +++ b/src/theme/badge.ts @@ -2,7 +2,7 @@ import type { ModuleOptions } from '../module' export default (options: Required) => ({ slots: { - base: 'rounded-[calc(var(--ui-radius)*1.5)] font-medium inline-flex items-center', + base: 'font-medium inline-flex items-center', label: 'truncate', leadingIcon: 'shrink-0', leadingAvatar: 'shrink-0', @@ -22,19 +22,19 @@ export default (options: Required) => ({ }, size: { sm: { - base: 'text-xs px-1.5 py-0.5 gap-1', + base: 'text-xs px-1.5 py-0.5 gap-1 rounded-[calc(var(--ui-radius))]', leadingIcon: 'size-4', leadingAvatarSize: '3xs', trailingIcon: 'size-4' }, md: { - base: 'text-xs px-2 py-1 gap-1', + base: 'text-xs px-2 py-1 gap-1 rounded-[calc(var(--ui-radius)*1.5)]', leadingIcon: 'size-4', leadingAvatarSize: '3xs', trailingIcon: 'size-4' }, lg: { - base: 'text-sm px-2 py-1 gap-1.5', + base: 'text-sm px-2 py-1 gap-1.5 rounded-[calc(var(--ui-radius)*1.5)]', leadingIcon: 'size-5', leadingAvatarSize: '2xs', trailingIcon: 'size-5' diff --git a/src/theme/navigation-menu.ts b/src/theme/navigation-menu.ts index 0a32a5e7..68956f1d 100644 --- a/src/theme/navigation-menu.ts +++ b/src/theme/navigation-menu.ts @@ -10,7 +10,7 @@ export default (options: Required) => ({ linkLeadingAvatar: 'shrink-0', linkLeadingAvatarSize: '2xs', linkTrailing: 'ms-auto inline-flex gap-1.5 items-center', - linkTrailingBadge: 'shrink-0 rounded-[var(--ui-radius)]', + linkTrailingBadge: 'shrink-0', linkTrailingBadgeSize: 'sm', linkTrailingIcon: 'size-5 transform shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200', linkLabel: 'truncate', diff --git a/test/components/__snapshots__/Badge.spec.ts.snap b/test/components/__snapshots__/Badge.spec.ts.snap index ed7316c0..ae4411a3 100644 --- a/test/components/__snapshots__/Badge.spec.ts.snap +++ b/test/components/__snapshots__/Badge.spec.ts.snap @@ -1,25 +1,25 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Badge > renders with as correctly 1`] = ` -"
+"
Badge
" `; exports[`Badge > renders with avatar and leadingIcon correctly 1`] = ` -" +" " `; exports[`Badge > renders with avatar and trailingIcon correctly 1`] = ` -" +" " `; exports[`Badge > renders with avatar correctly 1`] = ` -" +" " `; @@ -29,95 +29,95 @@ exports[`Badge > renders with class correctly 1`] = ` " `; -exports[`Badge > renders with default slot correctly 1`] = `"Default slot"`; +exports[`Badge > renders with default slot correctly 1`] = `"Default slot"`; exports[`Badge > renders with icon correctly 1`] = ` -" +" " `; exports[`Badge > renders with label correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with leading and icon correctly 1`] = ` -" +" " `; -exports[`Badge > renders with leading slot correctly 1`] = `"Leading slot"`; +exports[`Badge > renders with leading slot correctly 1`] = `"Leading slot"`; exports[`Badge > renders with leadingIcon correctly 1`] = ` -" +" " `; exports[`Badge > renders with neutral variant outline correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with neutral variant soft correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with neutral variant solid correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with neutral variant subtle correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with primary variant outline correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with primary variant soft correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with primary variant solid correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with primary variant subtle correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with size lg correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with size md correctly 1`] = ` -"Badge +"Badge " `; exports[`Badge > renders with size sm correctly 1`] = ` -"Badge +"Badge " `; -exports[`Badge > renders with trailing and icon correctly 1`] = `""`; +exports[`Badge > renders with trailing and icon correctly 1`] = `""`; -exports[`Badge > renders with trailing slot correctly 1`] = `"Trailing slot"`; +exports[`Badge > renders with trailing slot correctly 1`] = `"Trailing slot"`; -exports[`Badge > renders with trailingIcon correctly 1`] = `""`; +exports[`Badge > renders with trailingIcon correctly 1`] = `""`; exports[`Badge > renders with ui correctly 1`] = ` -"Badge +"Badge " `; diff --git a/test/components/__snapshots__/NavigationMenu.spec.ts.snap b/test/components/__snapshots__/NavigationMenu.spec.ts.snap index 83722859..06f7575d 100644 --- a/test/components/__snapshots__/NavigationMenu.spec.ts.snap +++ b/test/components/__snapshots__/NavigationMenu.spec.ts.snap @@ -4,7 +4,7 @@ exports[`NavigationMenu > renders with arrow correctly 1`] = ` "