update(c-alert): Add variant 'error'

This commit is contained in:
code2933 2023-10-18 14:48:37 +08:00
parent b2ad4f7a27
commit 5e455ba0e9
2 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
const variants = ['warning'] as const; const variants = ['warning', 'error'] as const;
</script> </script>
<template> <template>

View file

@ -3,6 +3,7 @@ import { defineThemes } from '../theme/theme.models';
import { appThemes } from '../theme/themes'; import { appThemes } from '../theme/themes';
import WarningIcon from '~icons/mdi/alert-circle-outline'; import WarningIcon from '~icons/mdi/alert-circle-outline';
import ErrorIcon from '~icons/mdi/close-circle-outline';
export const { useTheme } = defineThemes({ export const { useTheme } = defineThemes({
dark: { dark: {
@ -12,6 +13,12 @@ export const { useTheme } = defineThemes({
textColor: appThemes.dark.warning.color, textColor: appThemes.dark.warning.color,
icon: WarningIcon, icon: WarningIcon,
}, },
error: {
backgroundColor: appThemes.dark.error.colorFaded,
borderColor: appThemes.dark.error.color,
textColor: appThemes.dark.error.color,
icon: ErrorIcon,
},
}, },
light: { light: {
warning: { warning: {
@ -20,5 +27,11 @@ export const { useTheme } = defineThemes({
textColor: darken(appThemes.light.warning.color, 40), textColor: darken(appThemes.light.warning.color, 40),
icon: WarningIcon, icon: WarningIcon,
}, },
error: {
backgroundColor: appThemes.light.error.colorFaded,
borderColor: appThemes.light.error.color,
textColor: darken(appThemes.light.error.color, 40),
icon: ErrorIcon,
},
}, },
}); });