Skip to content

Commit fa05f25

Browse files
authored
Merge pull request #274 from dnum-mi/fix/accordion-expanded-stories
fix: 🐛 Corrige expandedId dans Storybook
2 parents e04e785 + 8652259 commit fa05f25

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/components/DsfrAccordion/DsfrAccordionsGroup.stories.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ export default {
99
control: 'boolean',
1010
description: 'Permet de voir le composant dans les deux **thèmes** : **clair** (`false`, défaut) et **sombre** (`true`).\n\n*N.B. : Ne fait pas partie du composant.*',
1111
},
12-
13-
expanded1: {
14-
control: 'boolean',
15-
},
16-
expanded2: {
17-
control: 'boolean',
18-
},
19-
expanded3: {
20-
control: 'boolean',
12+
expandedId: {
13+
control: 'radio',
14+
options: [
15+
'none',
16+
'accordion-1',
17+
'accordion-2',
18+
'accordion-3',
19+
],
2120
},
2221
title1: {
2322
control: 'text',
@@ -40,14 +39,14 @@ export const AccordeonGroupe = (args) => ({
4039
data () {
4140
return {
4241
...args,
43-
expandedId: undefined,
4442
}
4543
},
4644

4745
template: `
4846
<DsfrAccordionsGroup>
4947
<li>
5048
<DsfrAccordion
49+
id="accordion-1"
5150
:title="title1"
5251
:expanded-id="expandedId"
5352
@expand="expandedId = $event"
@@ -57,6 +56,7 @@ export const AccordeonGroupe = (args) => ({
5756
</li>
5857
<li>
5958
<DsfrAccordion
59+
id="accordion-2"
6060
:title="title2"
6161
:expanded-id="expandedId"
6262
@expand="id => expandedId = id"
@@ -66,6 +66,7 @@ export const AccordeonGroupe = (args) => ({
6666
</li>
6767
<li>
6868
<DsfrAccordion
69+
id="accordion-3"
6970
:title="title3"
7071
:expanded-id="expandedId"
7172
@expand="id => expandedId = id"
@@ -83,9 +84,7 @@ export const AccordeonGroupe = (args) => ({
8384
AccordeonGroupe.args = {
8485
dark: false,
8586
title1: 'Un titre d’accordéon',
86-
expanded1: false,
8787
title2: 'Un titre d’accordéon',
88-
expanded2: false,
8988
title3: 'Un titre d’accordéon',
90-
expanded3: false,
89+
expandedId: '',
9190
}

0 commit comments

Comments
 (0)