-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
@xen-orchestra/lite/src/stories/web-core/info/ui-info.story.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<template> | ||
<ComponentStory | ||
v-slot="{ properties, settings }" | ||
:params="[ | ||
prop('status').enum('info', 'success', 'warning', 'danger').required().preset('info').widget(), | ||
slot(), | ||
setting('defaultSlot').widget(text()).preset('message'), | ||
]" | ||
> | ||
<UiInfo v-bind="properties">{{ settings.defaultSlot }}</UiInfo> | ||
</ComponentStory> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import ComponentStory from '@/components/component-story/ComponentStory.vue' | ||
import { prop, setting, slot } from '@/libs/story/story-param' | ||
import { text } from '@/libs/story/story-widget' | ||
import UiInfo from '@core/components/info/UiInfo.vue' | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!-- v2 --> | ||
<template> | ||
<div class="vts-ui-info"> | ||
<UiIcon class="icon" :color :icon /> | ||
<p class="message"><slot /></p> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import UiIcon from '@core/components/icon/UiIcon.vue' | ||
import type { IconColor } from '@core/types/color.type' | ||
import { | ||
faCheckCircle, | ||
faExclamationCircle, | ||
faInfoCircle, | ||
faXmarkCircle, | ||
type IconDefinition, | ||
} from '@fortawesome/free-solid-svg-icons' | ||
import { computed } from 'vue' | ||
|
||
type Props = { | ||
status: 'info' | 'success' | 'warning' | 'danger' | ||
} | ||
const props = defineProps<Props>() | ||
|
||
const states: Record<Props['status'], { icon: IconDefinition; color: IconColor }> = { | ||
info: { icon: faInfoCircle, color: 'normal' }, | ||
success: { icon: faCheckCircle, color: 'success' }, | ||
warning: { icon: faExclamationCircle, color: 'warning' }, | ||
danger: { icon: faXmarkCircle, color: 'danger' }, | ||
} | ||
|
||
const icon = computed(() => states[props.status].icon) | ||
const color = computed(() => states[props.status].color) | ||
</script> | ||
|
||
<style lang="postcss" scoped> | ||
.vts-ui-info { | ||
align-items: center; | ||
display: flex; | ||
gap: 0.8rem; | ||
} | ||
|
||
.icon { | ||
font-size: 1.6rem; | ||
} | ||
|
||
.message { | ||
font-size: 1.2rem; | ||
} | ||
</style> |