Skip to content

Commit

Permalink
feat: add page table td actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pirhoo committed Jul 24, 2024
1 parent 657f096 commit 63b2fb0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
4 changes: 3 additions & 1 deletion components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ declare module 'vue' {
ColumnFilterBadge: typeof import('./src/components/ColumnFilterBadge.vue')['default']
ColumnFilterDropdown: typeof import('./src/components/ColumnFilterDropdown.vue')['default']
ContentTypeBadge: typeof import('./src/components/ContentTypeBadge.vue')['default']
copy: typeof import('./src/components/Display/DisplayStatus copy.vue')['default']
copy: typeof import('./src/components/PageTable/PageTableTr copy.vue')['default']
DismissableAlert: typeof import('./src/components/Dismissable/DismissableAlert.vue')['default']
DismissableToastBody: typeof import('./src/components/Dismissable/DismissableToastBody.vue')['default']
DisplayContentLength: typeof import('./src/components/Display/DisplayContentLength.vue')['default']
Expand Down Expand Up @@ -216,8 +216,10 @@ declare module 'vue' {
PageSettingsTitle: typeof import('./src/components/PageSettings/PageSettingsTitle.vue')['default']
PageTable: typeof import('./src/components/PageTable/PageTable.vue')['default']
PageTableTd: typeof import('./src/components/PageTable/PageTableTd.vue')['default']
PageTableTdActions: typeof import('./src/components/PageTable/PageTableTdActions.vue')['default']
PageTableTh: typeof import('./src/components/PageTable/PageTableTh.vue')['default']
PageTableTr: typeof import('./src/components/PageTable/PageTableTr.vue')['default']
PageTableTrActions: typeof import('./src/components/PageTable/PageTableTrActions.vue')['default']
Pagination: typeof import('./src/components/Pagination.vue')['default']
Plugins: typeof import('./src/components/Plugins.vue')['default']
ProjectButton: typeof import('./src/components/Project/ProjectButton.vue')['default']
Expand Down
18 changes: 18 additions & 0 deletions src/components/PageTable/PageTableTdActions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<b-td class="page-table-td-actions">
<div class="d-flex">
<slot />
</div>
</b-td>
</template>

<style lang="scss">
.page-table-td-actions > * {
visibility: hidden;
}
.page-table-tr--active > .page-table-td-actions > *,
.page-table-tr:hover > .page-table-td-actions > * {
visibility: visible;
}
</style>
33 changes: 29 additions & 4 deletions src/stories/components/PageTable/PageTable.stories.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import DisplayDatetime from '@/components/Display/DisplayDatetime'
import DisplayStatus from '@/components/Display/DisplayStatus'
import DisplayVisibility from '@/components/Display/DisplayVisibility'
import IconButton from '@/components/IconButton'
import PageTable from '@/components/PageTable/PageTable'
import PageTableTdActions from '@/components/PageTable/PageTableTdActions'
import PageTableTh from '@/components/PageTable/PageTableTh'
import PageTableTr from '@/components/PageTable/PageTableTr'
import ProjectLabel from '@/components/Project/ProjectLabel'
import DisplayStatus from '@/components/Display/DisplayStatus'
import DisplayVisibility from '@/components/Display/DisplayVisibility'
import DisplayDatetime from '@/components/Display/DisplayDatetime'

export default {
title: 'Components/PageTable/PageTable',
Expand Down Expand Up @@ -79,11 +81,13 @@ export default {
export const Default = {}

export const WithoutSelectMode = {
render: (args) => ({
render: () => ({
components: {
IconButton,
PageTable,
PageTableTh,
PageTableTr,
PageTableTdActions,
ProjectLabel,
DisplayStatus,
DisplayVisibility,
Expand All @@ -100,6 +104,7 @@ export const WithoutSelectMode = {
<page-table-th label="Project" icon="circles-three-plus" />
<page-table-th label="Author" icon="user-circle" />
<page-table-th label="Created" icon="calendar-blank" />
<page-table-th label="Actions" hide-label />
</template>
<page-table-tr>
<td><display-status value="queued" /></td>
Expand All @@ -110,6 +115,11 @@ export const WithoutSelectMode = {
<td><project-label project="Project 1" hide-thumbnail /></td>
<td>John Doe</td>
<td><display-datetime value="2021-09-01" /></td>
<page-table-td-actions>
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="magnifying-glass" class="border-0 me-1" />
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="arrow-clockwise" class="border-0 me-1" />
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="trash" class="border-0 me-1" />
</page-table-td-actions>
</page-table-tr>
<page-table-tr>
<td><display-status value="success" /></td>
Expand All @@ -120,6 +130,11 @@ export const WithoutSelectMode = {
<td><project-label project="Project 2" hide-thumbnail /></td>
<td>Jane Doe</td>
<td><display-datetime value="2021-09-02" /></td>
<page-table-td-actions>
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="magnifying-glass" class="border-0 me-1" />
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="arrow-clockwise" class="border-0 me-1" />
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="trash" class="border-0 me-1" />
</page-table-td-actions>
</page-table-tr>
<page-table-tr>
<td><display-status value="failure" /></td>
Expand All @@ -130,6 +145,11 @@ export const WithoutSelectMode = {
<td><project-label project="Project 3" hide-thumbnail /></td>
<td>Jan Doe</td>
<td><display-datetime value="2021-09-03" /></td>
<page-table-td-actions>
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="magnifying-glass" class="border-0 me-1" />
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="arrow-clockwise" class="border-0 me-1" />
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="trash" class="border-0 me-1" />
</page-table-td-actions>
</page-table-tr>
<page-table-tr>
<td><display-status value="draft" /></td>
Expand All @@ -140,6 +160,11 @@ export const WithoutSelectMode = {
<td><project-label project="Project 4" hide-thumbnail /></td>
<td>Jin Doe</td>
<td><display-datetime value="2021-09-04" /></td>
<page-table-td-actions>
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="magnifying-glass" class="border-0 me-1" />
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="arrow-clockwise" class="border-0 me-1" />
<icon-button variant="outline-tertiary" square hide-label size="sm" icon-left="trash" class="border-0 me-1" />
</page-table-td-actions>
</page-table-tr>
</page-table>
`
Expand Down

0 comments on commit 63b2fb0

Please sign in to comment.