-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web-core): added UiTableActions component (#8072)
- Loading branch information
Showing
2 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
@xen-orchestra/lite/src/stories/web-core/ui/table-actions/ui-table-actions.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,50 @@ | ||
<template> | ||
<ComponentStory | ||
v-slot="{ properties, settings }" | ||
:params="[ | ||
prop('title').str(), | ||
slot(), | ||
slot('title').help('Meant to receive text item like title'), | ||
slot('groupedBy').help('Meant to receive grouped item like breadcrumb'), | ||
setting('titleSlotContent').widget(text()).preset('Actions title'), | ||
]" | ||
> | ||
<UiTableActions v-bind="properties"> | ||
<UiButton | ||
v-for="(label, index) in buttonLabels" | ||
:key="index" | ||
:left-icon="label.icon" | ||
variant="tertiary" | ||
accent="info" | ||
size="medium" | ||
> | ||
{{ label.title }} | ||
</UiButton> | ||
<template #title> | ||
<UiActionsTitle> | ||
{{ settings.titleSlotContent }} | ||
</UiActionsTitle> | ||
</template> | ||
<template #groupedBy> | ||
<span>Grouped By</span> | ||
</template> | ||
</UiTableActions> | ||
</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 UiActionsTitle from '@core/components/ui/actions-title/UiActionsTitle.vue' | ||
import UiButton from '@core/components/ui/button/UiButton.vue' | ||
import UiTableActions from '@core/components/ui/table-actions/UiTableActions.vue' | ||
import { faArrowsAlt, faCalendarDays, faCircleChevronRight } from '@fortawesome/free-solid-svg-icons' | ||
import { ref } from 'vue' | ||
const buttonLabels = ref([ | ||
{ title: 'Label', icon: faArrowsAlt }, | ||
{ title: 'Label', icon: faCircleChevronRight }, | ||
{ title: 'Label', icon: faCalendarDays }, | ||
]) | ||
</script> |
46 changes: 46 additions & 0 deletions
46
@xen-orchestra/web-core/lib/components/ui/table-actions/UiTableActions.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,46 @@ | ||
<!-- v2 --> | ||
<template> | ||
<div class="ui-table-actions"> | ||
<div class="actions"> | ||
<slot name="title"> | ||
<UiActionsTitle> | ||
{{ title }} | ||
</UiActionsTitle> | ||
</slot> | ||
<slot /> | ||
</div> | ||
<div v-if="slots.groupedBy"> | ||
<slot name="groupedBy" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import UiActionsTitle from '@core/components/ui/actions-title/UiActionsTitle.vue' | ||
defineProps<{ | ||
title?: string | ||
}>() | ||
const slots = defineSlots<{ | ||
default(): any | ||
title(): any | ||
groupedBy?(): any | ||
}>() | ||
</script> | ||
|
||
<style scoped lang="postcss"> | ||
.ui-table-actions { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding-block: 0.4rem; | ||
border-bottom: 0.1rem solid var(--color-neutral-border); | ||
.actions { | ||
display: flex; | ||
align-items: center; | ||
gap: 2.4rem; | ||
} | ||
} | ||
</style> |