✨ feature: Added Hint component
This commit is contained in:
parent
7dfca1b256
commit
e6ece32d74
54
src/components/hint/VHint.vue
Normal file
54
src/components/hint/VHint.vue
Normal file
|
@ -0,0 +1,54 @@
|
|||
<script setup lang="ts">
|
||||
import Message from 'primevue/message';
|
||||
import type IVHint from './IVHint.type';
|
||||
import { computed } from 'vue';
|
||||
import styles from '@visua/typography.module.css';
|
||||
|
||||
const props = withDefaults(defineProps<IVHint>(), {
|
||||
title: '',
|
||||
icon: false,
|
||||
type: '',
|
||||
disabled: false,
|
||||
})
|
||||
|
||||
const iconClass = computed(() => {
|
||||
switch (props.type) {
|
||||
case 'alert': return 'ri-spam-fill';
|
||||
case 'warning' : return 'ri-alert-fill';
|
||||
case 'success' : return 'var(--text-default-success)';
|
||||
case 'info': return 'ri-information-fill';
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
|
||||
const severity = computed(() => {
|
||||
switch (props.type) {
|
||||
case 'alert': return 'error';
|
||||
case 'warning' : return 'warn';
|
||||
case 'success' : return 'success';
|
||||
case 'info' : return 'info';
|
||||
case 'active': return 'contrast'
|
||||
default:
|
||||
return 'secondary';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Message
|
||||
variant="simple"
|
||||
:severity="severity"
|
||||
:class="[styles['text-body-XS-mention-text-Regular'], {'disabled': props.disabled }]"
|
||||
:icon="props.icon ? iconClass: undefined"
|
||||
:closable="false"
|
||||
size="small"
|
||||
role="alert"
|
||||
>
|
||||
{{ props.title }}
|
||||
</Message>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.p-message.disabled {color: var(--text-disabled-grey);}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user