Skip to content

Commit 15781e6

Browse files
committed
refactor(DsfrTableHeaders): ♻️ convertit les stories au format CSF3
1 parent 4edda6c commit 15781e6

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed
Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import type { Meta, StoryObj } from '@storybook/vue3-vite'
2+
13
import DsfrTable from './DsfrTable.vue'
24
import DsfrTableHeaders from './DsfrTableHeaders.vue'
35

4-
export default {
6+
const meta = {
57
component: DsfrTableHeaders,
68
title: 'Composants/DsfrTableHeaders',
79
argTypes: {
@@ -11,39 +13,40 @@ export default {
1113
description: 'Liste des en-têtes du tableau (tableau de string).',
1214
},
1315
},
14-
}
16+
} as Meta<typeof DsfrTableHeaders>
17+
18+
export default meta
19+
type Story = StoryObj<typeof meta>
1520

1621
const title = 'Utilisateurs'
1722
const headers = ['Nom', 'Prénom', 'Email', 'Téléphone', 'Portable', 'Statut']
1823

19-
export const EnTetesDeTableau = (args) => ({
20-
components: {
21-
DsfrTable,
22-
DsfrTableHeaders,
23-
},
24-
25-
data () {
26-
return {
27-
...args,
28-
}
24+
export const EnTetesDeTableau: Story = {
25+
args: {
26+
title,
27+
headers,
2928
},
30-
31-
template: `
29+
render: (args: any) => ({
30+
components: {
31+
DsfrTable,
32+
DsfrTableHeaders,
33+
},
34+
setup () {
35+
return { args }
36+
},
37+
template: `
3238
<DsfrTable
33-
:title="title"
39+
:title="args.title"
3440
>
3541
<template v-slot:header>
36-
<DsfrTableHeaders :headers="headers" />
42+
<DsfrTableHeaders :headers="args.headers" />
3743
</template>
3844
<tr>
3945
<td colspan="6">
4046
Corps du tableau
4147
</td>
4248
</tr>
4349
</DsfrTable>
44-
`,
45-
})
46-
EnTetesDeTableau.args = {
47-
title,
48-
headers,
50+
`,
51+
}),
4952
}

0 commit comments

Comments
 (0)