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 flex items-center gap-4 bg-white/10 mb-6 p-4 rounded-md text-k-text-primary"
:class="`alert-box-${props.type}`"
>
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>
<script setup lang="ts">
import {
faCheckCircle,
faExclamationCircle,
faExclamationTriangle,
faInfoCircle
} from '@fortawesome/free-solid-svg-icons'
const props = withDefaults(defineProps<{ type?: 'default' | 'info' | 'danger' | 'success' | 'warning' }>(), {
type: 'default'
})
</script>
2024-04-04 20:13:35 +00:00
<style scoped lang="postcss">
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>