Skip to content

Commit efb298c

Browse files
committed
feat: ✨ Ajout d'un slot au sein de la mise en exergue
1 parent 4888234 commit efb298c

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

src/components/DsfrHighlight/DsfrHighlight.stories.js

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,51 @@ export const MiseEnExergue = (args) => ({
3232
return { ...args }
3333
},
3434

35+
mounted () {
36+
document.body.parentElement.setAttribute('data-fr-theme', this.dark ? 'dark' : 'light')
37+
},
38+
3539
template: `
36-
<div :data-fr-theme="dark ? 'dark' : ''" style="background-color: var(--grey-1000-50);">
37-
<DsfrHighlight
38-
:text="text"
39-
:small="small"
40-
:large="large"
41-
/>
42-
</div>
40+
<DsfrHighlight
41+
:text="text"
42+
:small="small"
43+
:large="large"
44+
/>
4345
`,
4446
})
45-
4647
MiseEnExergue.args = {
4748
dark: false,
4849
small: false,
4950
large: false,
5051
text: 'Texte original de la mise en exergue',
5152
}
53+
54+
export const MiseEnExergueAvecSlot = (args) => ({
55+
components: {
56+
DsfrHighlight,
57+
},
58+
59+
data () {
60+
return { ...args }
61+
},
62+
63+
mounted () {
64+
document.body.parentElement.setAttribute('data-fr-theme', this.dark ? 'dark' : 'light')
65+
},
66+
67+
template: `
68+
<DsfrHighlight
69+
:text="text"
70+
:small="small"
71+
:large="large"
72+
>
73+
<p v-if="!text">Le fameux slot mis en exergue</p>
74+
</DsfrHighlight>
75+
`,
76+
})
77+
MiseEnExergueAvecSlot.args = {
78+
dark: false,
79+
small: false,
80+
large: false,
81+
text: '',
82+
}

src/components/DsfrHighlight/DsfrHighlight.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export default defineComponent({
2424
}"
2525
>
2626
{{ text }}
27+
<!-- @slot Slot par défaut pour le contenu de la mise en exergue -->
28+
<slot />
2729
</p>
2830
</div>
2931
</template>

0 commit comments

Comments
 (0)