fix(Alert): default variant to solid for consistency

This commit is contained in:
Benjamin Canac
2024-10-07 14:57:46 +02:00
parent 9368c6a639
commit 3a7c5c2601
4 changed files with 34 additions and 18 deletions

View File

@@ -98,7 +98,7 @@ ignore:
- icon - icon
props: props:
color: neutral color: neutral
variant: solid variant: subtle
title: 'Heads up!' title: 'Heads up!'
description: 'You can change the primary color in your app config.' description: 'You can change the primary color in your app config.'
icon: 'i-heroicons-command-line' icon: 'i-heroicons-command-line'
@@ -120,9 +120,13 @@ ignore:
- title - title
- description - description
- close - close
- color
- variant
props: props:
title: 'Heads up!' title: 'Heads up!'
description: 'You can change the primary color in your app config.' description: 'You can change the primary color in your app config.'
color: neutral
variant: outline
close: true close: true
--- ---
:: ::
@@ -137,9 +141,13 @@ ignore:
- description - description
- close.color - close.color
- close.variant - close.variant
- color
- variant
props: props:
title: 'Heads up!' title: 'Heads up!'
description: 'You can change the primary color in your app config.' description: 'You can change the primary color in your app config.'
color: neutral
variant: outline
close: close:
color: primary color: primary
variant: outline variant: outline
@@ -158,9 +166,13 @@ ignore:
- title - title
- description - description
- close - close
- color
- variant
props: props:
title: 'Heads up!' title: 'Heads up!'
description: 'You can change the primary color in your app config.' description: 'You can change the primary color in your app config.'
color: neutral
variant: outline
close: true close: true
closeIcon: 'i-heroicons-arrow-right' closeIcon: 'i-heroicons-arrow-right'
--- ---
@@ -180,9 +192,13 @@ prettier: true
ignore: ignore:
- title - title
- actions - actions
- color
- variant
props: props:
title: 'Heads up!' title: 'Heads up!'
description: 'You can change the primary color in your app config.' description: 'You can change the primary color in your app config.'
color: neutral
variant: outline
actions: actions:
- label: Action 1 - label: Action 1
- label: Action 2 - label: Action 2
@@ -199,7 +215,7 @@ Actions renders differently when the description is not set. You can try to remo
### `class` prop ### `class` prop
Use the `class` prop to override the base styles of the Button. Use the `class` prop to override the base styles of the Alert.
::component-code ::component-code
--- ---
@@ -216,7 +232,7 @@ props:
### `ui` prop ### `ui` prop
Use the `ui` prop to override the slots styles of the Button. Use the `ui` prop to override the slots styles of the Alert.
::component-code ::component-code
--- ---

View File

@@ -25,7 +25,7 @@ const data = {
<UAlert :title="data.title" /> <UAlert :title="data.title" />
<UAlert :title="data.title" :icon="data.icon" /> <UAlert :title="data.title" :icon="data.icon" />
<UAlert :title="data.title" :icon="data.icon" :close="data.close" /> <UAlert :title="data.title" :icon="data.icon" :close="data.close" />
<UAlert :title="data.title" :icon="data.icon" :close="data.close" :actions="actions('primary')" /> <UAlert :title="data.title" :icon="data.icon" :close="data.close" :actions="actions('neutral')" />
<UAlert :title="data.title" :icon="data.icon" :close="data.close" :description="data.description" /> <UAlert :title="data.title" :icon="data.icon" :close="data.close" :description="data.description" />
<UAlert :title="data.title" :avatar="{ src: 'https://avatars.githubusercontent.com/u/739984?v=4' }" :close="data.close" :description="data.description" /> <UAlert :title="data.title" :avatar="{ src: 'https://avatars.githubusercontent.com/u/739984?v=4' }" :close="data.close" :description="data.description" />
</div> </div>

View File

@@ -85,6 +85,6 @@ export default (options: Required<ModuleOptions>) => ({
}], }],
defaultVariants: { defaultVariants: {
color: 'primary', color: 'primary',
variant: 'outline' variant: 'solid'
} }
}) })

View File

@@ -1,7 +1,7 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`Alert > renders with as correctly 1`] = ` exports[`Alert > renders with as correctly 1`] = `
"<article class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<article class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
@@ -13,7 +13,7 @@ exports[`Alert > renders with as correctly 1`] = `
`; `;
exports[`Alert > renders with avatar correctly 1`] = ` exports[`Alert > renders with avatar correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"><span class="inline-flex items-center justify-center select-none overflow-hidden rounded-full align-middle bg-[--ui-bg-elevated] size-11 text-[22px] shrink-0"><img role="img" src="https://avatars.githubusercontent.com/u/739984?v=4" class="h-full w-full rounded-[inherit] object-cover" style="display: none;"><span class="font-medium leading-none text-[--ui-text-muted] truncate"></span></span> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]"><span class="inline-flex items-center justify-center select-none overflow-hidden rounded-full align-middle bg-[--ui-bg-elevated] size-11 text-[22px] shrink-0"><img role="img" src="https://avatars.githubusercontent.com/u/739984?v=4" class="h-full w-full rounded-[inherit] object-cover" style="display: none;"><span class="font-medium leading-none text-[--ui-text-muted] truncate"></span></span>
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
<!--v-if--> <!--v-if-->
@@ -24,7 +24,7 @@ exports[`Alert > renders with avatar correctly 1`] = `
`; `;
exports[`Alert > renders with class correctly 1`] = ` exports[`Alert > renders with class correctly 1`] = `
"<div class="relative overflow-hidden rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25 w-48"> "<div class="relative overflow-hidden rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg] w-48">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
@@ -36,7 +36,7 @@ exports[`Alert > renders with class correctly 1`] = `
`; `;
exports[`Alert > renders with close correctly 1`] = ` exports[`Alert > renders with close correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
@@ -51,7 +51,7 @@ exports[`Alert > renders with close correctly 1`] = `
`; `;
exports[`Alert > renders with close slot correctly 1`] = ` exports[`Alert > renders with close slot correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
@@ -63,7 +63,7 @@ exports[`Alert > renders with close slot correctly 1`] = `
`; `;
exports[`Alert > renders with closeIcon correctly 1`] = ` exports[`Alert > renders with closeIcon correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
@@ -78,7 +78,7 @@ exports[`Alert > renders with closeIcon correctly 1`] = `
`; `;
exports[`Alert > renders with description correctly 1`] = ` exports[`Alert > renders with description correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-start text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-start bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
@@ -90,7 +90,7 @@ exports[`Alert > renders with description correctly 1`] = `
`; `;
exports[`Alert > renders with description slot correctly 1`] = ` exports[`Alert > renders with description slot correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
@@ -102,7 +102,7 @@ exports[`Alert > renders with description slot correctly 1`] = `
`; `;
exports[`Alert > renders with icon correctly 1`] = ` exports[`Alert > renders with icon correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"><span class="iconify i-heroicons:light-bulb shrink-0 size-5" aria-hidden="true"></span> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]"><span class="iconify i-heroicons:light-bulb shrink-0 size-5" aria-hidden="true"></span>
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
<!--v-if--> <!--v-if-->
@@ -113,7 +113,7 @@ exports[`Alert > renders with icon correctly 1`] = `
`; `;
exports[`Alert > renders with leading slot correctly 1`] = ` exports[`Alert > renders with leading slot correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Leading slot</div> <div class="text-sm font-medium">Leading slot</div>
@@ -221,7 +221,7 @@ exports[`Alert > renders with primary variant subtle correctly 1`] = `
`; `;
exports[`Alert > renders with title correctly 1`] = ` exports[`Alert > renders with title correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Alert</div> <div class="text-sm font-medium">Alert</div>
@@ -233,7 +233,7 @@ exports[`Alert > renders with title correctly 1`] = `
`; `;
exports[`Alert > renders with title slot correctly 1`] = ` exports[`Alert > renders with title slot correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-medium">Title slot</div> <div class="text-sm font-medium">Title slot</div>
@@ -245,7 +245,7 @@ exports[`Alert > renders with title slot correctly 1`] = `
`; `;
exports[`Alert > renders with ui correctly 1`] = ` exports[`Alert > renders with ui correctly 1`] = `
"<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center text-[--ui-primary] ring ring-inset ring-[--ui-primary]/25"> "<div class="relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5 items-center bg-[--ui-primary] text-[--ui-bg]">
<!--v-if--> <!--v-if-->
<div class="min-w-0 flex-1 flex flex-col gap-1"> <div class="min-w-0 flex-1 flex flex-col gap-1">
<div class="text-sm font-bold">Alert</div> <div class="text-sm font-bold">Alert</div>