koel/resources/assets/js/components/ui/AlertBox.vue

49 lines
1 KiB
Vue
Raw Normal View History

2024-03-30 16:49:25 +00:00
<template>
2024-04-04 22:20:42 +00:00
<div
:class="`alert-box-${props.type}`"
2024-04-23 21:01:27 +00:00
class="alert-box flex items-center gap-4 bg-white/10 mb-6 p-4 rounded-md text-k-text-primary"
2024-04-04 22:20:42 +00:00
>
2024-03-30 16:49:25 +00:00
<Icon v-if="props.type === 'info' || props.type === 'default'" :icon="faInfoCircle" />
<Icon v-if="props.type === 'danger'" :icon="faExclamationCircle" />
<Icon v-if="props.type === 'success'" :icon="faCheckCircle" />
<Icon v-if="props.type === 'warning'" :icon="faExclamationTriangle" />
2024-04-04 22:20:42 +00:00
<div class="flex-1">
2024-03-30 16:49:25 +00:00
<slot />
</div>
</div>
</template>
2024-04-23 21:01:27 +00:00
<script lang="ts" setup>
2024-03-30 16:49:25 +00:00
import {
faCheckCircle,
faExclamationCircle,
faExclamationTriangle,
faInfoCircle,
2024-03-30 16:49:25 +00:00
} from '@fortawesome/free-solid-svg-icons'
const props = withDefaults(defineProps<{ type?: 'default' | 'info' | 'danger' | 'success' | 'warning' }>(), {
type: 'default',
2024-03-30 16:49:25 +00:00
})
</script>
2024-04-23 21:01:27 +00:00
<style lang="postcss" scoped>
2024-03-30 16:49:25 +00:00
.alert-box {
&-info {
2024-04-04 22:20:42 +00:00
@apply bg-blue-500;
2024-03-30 16:49:25 +00:00
}
&-success {
2024-04-04 22:20:42 +00:00
@apply bg-green-600;
2024-03-30 16:49:25 +00:00
}
&-warning {
2024-04-04 22:20:42 +00:00
@apply bg-orange-500;
2024-03-30 16:49:25 +00:00
}
&-danger {
2024-04-04 22:20:42 +00:00
@apply bg-red-500;
2024-03-30 16:49:25 +00:00
}
}
</style>