mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-08 07:11:03 -04:00
feat(c-alert): added title
This commit is contained in:
parent
dfc4d2ea28
commit
e43abeeddf
2 changed files with 13 additions and 2 deletions
|
@ -3,9 +3,17 @@ const variants = ['warning', 'error'] as const;
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<h2>Basic</h2>
|
||||
<c-alert v-for="variant in variants" :key="variant" :type="variant" mb-4>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Magni reprehenderit itaque enim? Suscipit magni optio velit
|
||||
quia, eveniet repellat pariatur quaerat laudantium dignissimos natus, beatae deleniti adipisci, atque necessitatibus
|
||||
odio!
|
||||
</c-alert>
|
||||
|
||||
<h2>With title</h2>
|
||||
<c-alert v-for="variant in variants" :key="variant" :type="variant" title="This is the title" mb-4>
|
||||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Magni reprehenderit itaque enim? Suscipit magni optio velit
|
||||
quia, eveniet repellat pariatur quaerat laudantium dignissimos natus, beatae deleniti adipisci, atque necessitatibus
|
||||
odio!
|
||||
</c-alert>
|
||||
</template>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script lang="ts" setup>
|
||||
import { useTheme } from './c-alert.theme';
|
||||
|
||||
const props = withDefaults(defineProps<{ type?: 'warning' }>(), { type: 'warning' });
|
||||
const { type } = toRefs(props);
|
||||
const props = withDefaults(defineProps<{ type?: 'warning'; title?: string }>(), { type: 'warning', title: undefined });
|
||||
const { type, title } = toRefs(props);
|
||||
|
||||
const theme = useTheme();
|
||||
const variantTheme = computed(() => theme.value[type.value]);
|
||||
|
@ -17,6 +17,9 @@ const variantTheme = computed(() => theme.value[type.value]);
|
|||
</div>
|
||||
|
||||
<div class="c-alert--content">
|
||||
<div v-if="title" class="c-alert--title" text-15px fw-600>
|
||||
{{ title }}
|
||||
</div>
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue