File tree Expand file tree Collapse file tree 8 files changed +28
-68
lines changed
Expand file tree Collapse file tree 8 files changed +28
-68
lines changed Original file line number Diff line number Diff line change 11import type { Preview } from "@storybook/vue3"
2+ import { setup } from "@storybook/vue3"
23import { themes } from '@storybook/theming'
34import { withThemeByDataAttribute } from "@storybook/addon-styling"
5+ import { FocusTrap } from 'focus-trap-vue'
6+ import { defineComponent } from 'vue'
7+ import { OhVueIcon as VIcon } from 'oh-vue-icons'
48
59import VueDsfrTheme from './vue-dsfr-theme.js'
610import '../src/assets/variables-fdr.css'
@@ -89,4 +93,20 @@ const preview: Preview = {
8993 } ,
9094}
9195
96+ const RouterLink = defineComponent ( {
97+ name : 'RouterLink' ,
98+ props : {
99+ to : String ,
100+ } ,
101+ template : `
102+ <a :href="to" v-bind="$attrs"><slot /></a>
103+ ` ,
104+ } )
105+
106+ setup ( app => {
107+ app . component ( 'RouterLink' , RouterLink ) ;
108+ app . component ( 'VIcon' , VIcon )
109+ app . component ( 'FocusTrap' , FocusTrap )
110+ } )
111+
92112export default preview ;
Original file line number Diff line number Diff line change 11import type { HTMLAttributes , StyleValue } from 'vue'
22import type { RouteLocationRaw } from 'vue-router'
3+ import { OhVueIcon } from 'oh-vue-icons'
34
45export type DsfrHeaderMenuLinkProps = {
56 button ?: boolean
67 icon ?: string
7- iconAttrs ?: HTMLAttributes
8+ iconAttrs ?: InstanceType < typeof OhVueIcon > [ '$props' ] & HTMLAttributes
89 iconRight ?: boolean
910 label ?: string
1011 target ?: string
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ const linkData = computed(() => {
5858 @click.stop =" onClick"
5959 >
6060 <template
61- v-if =" (icon || iconAttrs ) && ! iconRight "
61+ v-if =" (icon || iconAttrs ?. name ) && ! iconRight "
6262 >
6363 <VIcon
6464 :name =" icon"
@@ -70,7 +70,7 @@ const linkData = computed(() => {
7070 {{ label }}
7171
7272 <template
73- v-if =" (icon || iconAttrs ) && iconRight "
73+ v-if =" (icon || iconAttrs ?. name ) && iconRight "
7474 >
7575 <VIcon
7676 :name =" icon"
Original file line number Diff line number Diff line change 1- import { setup } from '@storybook/vue3'
2-
31import DsfrNavigation from './DsfrNavigation.vue'
42
5- const RouterLink = {
6- name : 'RouterLink' ,
7- props : {
8- to : String ,
9- } ,
10- template : `
11- <a :href="to" v-bind="$attrs"><slot /></a>
12- ` ,
13- }
14-
15- setup ( app => {
16- app . component ( 'RouterLink' , RouterLink )
17- } )
18-
193/**
204 * [Voir quand l’utiliser sur la documentation du DSFR](https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/navigation-principale)
215 */
Original file line number Diff line number Diff line change @@ -3,22 +3,6 @@ import DsfrNavigationItem from './DsfrNavigationItem.vue'
33import DsfrNavigationMegaMenu from './DsfrNavigationMegaMenu.vue'
44import DsfrNavigationMegaMenuCategory from './DsfrNavigationMegaMenuCategory.vue'
55
6- import { setup } from '@storybook/vue3'
7-
8- const RouterLink = {
9- name : 'RouterLink' ,
10- props : {
11- to : String ,
12- } ,
13- template : `
14- <a :href="to" v-bind="$attrs"><slot /></a>
15- ` ,
16- }
17-
18- setup ( app => {
19- app . component ( 'RouterLink' , RouterLink )
20- } )
21-
226export default {
237 component : DsfrNavigationMegaMenuCategory ,
248 title : 'Composants/DsfrNavigationMegaMenuCategory' ,
Original file line number Diff line number Diff line change @@ -4,22 +4,6 @@ import DsfrNavigationMenu from './DsfrNavigationMenu.vue'
44import DsfrNavigationMenuItem from './DsfrNavigationMenuItem.vue'
55import DsfrNavigationMenuLink from './DsfrNavigationMenuLink.vue'
66
7- import { setup } from '@storybook/vue3'
8-
9- const RouterLink = {
10- name : 'RouterLink' ,
11- props : {
12- to : String ,
13- } ,
14- template : `
15- <a :href="to" v-bind="$attrs"><slot /></a>
16- ` ,
17- }
18-
19- setup ( app => {
20- app . component ( 'RouterLink' , RouterLink )
21- } )
22-
237export default {
248 component : DsfrNavigationMenuItem ,
259 title : 'Composants/DsfrNavigationMenuItem' ,
Original file line number Diff line number Diff line change 11import DsfrNavigationMenuLink from './DsfrNavigationMenuLink.vue'
22import DsfrNavigation from './DsfrNavigation.vue'
33
4- import { setup } from '@storybook/vue3'
5-
64import { addIcons } from 'oh-vue-icons'
75import { RiHome2Line } from 'oh-vue-icons/icons/ri/index.js'
86
97addIcons ( RiHome2Line )
108
11- const RouterLink = {
12- name : 'RouterLink' ,
13- props : {
14- to : String ,
15- } ,
16- template : `
17- <a :href="to" v-bind="$attrs"><slot /></a>
18- ` ,
19- }
20-
21- setup ( app => {
22- app . component ( 'RouterLink' , RouterLink )
23- } )
24-
259export default {
2610 component : DsfrNavigationMenuLink ,
2711 title : 'Composants/DsfrNavigationMenuLink' ,
Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ const projectDir = dirname(new URL(import.meta.url).pathname)
1010const isVitepress = process . env . VITEPRESS === 'true'
1111
1212const config : UserConfig = {
13- plugins : [ vue ( ) , vueJsx ( ) ] ,
13+ plugins : [
14+ vue ( ) ,
15+ vueJsx ( ) ,
16+ ] ,
1417 resolve : {
1518 alias : {
1619 '@' : fileURLToPath ( new URL ( './src' , import . meta. url ) ) ,
You can’t perform that action at this time.
0 commit comments