refactor: introduced variants to table in storybook

This commit is contained in:
Joel Jacob Stephen
2023-07-09 13:07:27 +05:30
parent c19a8be6e9
commit fb234cbf7e
2 changed files with 32 additions and 9 deletions

View File

@@ -106,14 +106,12 @@ const props = defineProps<{
/** The index of the column that needs to have a badge */ /** The index of the column that needs to have a badge */
badgeColName?: string badgeColName?: string
/** The subtitles to be displayed for the columns */ /** The subtitles to be displayed for the columns */
subtitles?: [ subtitles?: Array<{
{ /** The name of the column that needs to have a subtitle */
/** The name of the column that needs to have a subtitle */ colName: string
colName: string /** The subtitle to be displayed for the column */
/** The subtitle to be displayed for the column */ subtitle: string | string[]
subtitle: string | string[] }>
}
]
}>() }>()
defineEmits<{ defineEmits<{

View File

@@ -1,12 +1,30 @@
<template> <template>
<Story title="Table"> <Story title="Table">
<Variant title="Single"> <Variant title="Basic">
<HoppSmartTable <HoppSmartTable
cell-styles="px-6 py-2" cell-styles="px-6 py-2"
:list="list" :list="list"
:headings="headings" :headings="headings"
/> />
</Variant> </Variant>
<Variant title="Badges">
<HoppSmartTable
cell-styles="px-6 py-2"
:list="list"
:headings="headings"
badge-col-name="name"
badge-name="Admin"
:badge-row-indices="[0, 1]"
/>
</Variant>
<Variant title="Subtitles">
<HoppSmartTable
cell-styles="px-6 py-2"
:list="list"
:headings="headings"
:subtitles="subtitles"
/>
</Variant>
</Story> </Story>
</template> </template>
@@ -29,4 +47,11 @@ const list = [
role: "Frontend Engineer", role: "Frontend Engineer",
}, },
] ]
const subtitles = [
{
colName: "role",
subtitle: "FE",
},
]
</script> </script>