Skip to content

Commit

Permalink
feat(web-core): added UiTableActions component (#8072)
Browse files Browse the repository at this point in the history
  • Loading branch information
J0ris-K authored Nov 15, 2024
1 parent 09b4246 commit 2dafb3a
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
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>
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>

0 comments on commit 2dafb3a

Please sign in to comment.