From 2fbbd1a2849053245ca3c52694a438cbfd9c1681 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stanislas=20Ormi=C3=A8res?=
Date: Sun, 15 Sep 2024 13:01:53 +0200
Subject: [PATCH 1/5] =?UTF-8?q?feat(DsfrFooter):=20=E2=9C=A8=20g=C3=A8re?=
=?UTF-8?q?=20l=E2=80=99attribut=20title=20des=20liens?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
fix #884
---
src/components/DsfrFooter/DsfrFooter.types.ts | 7 +++---
src/components/DsfrFooter/DsfrFooter.vue | 24 ++++++++++++++-----
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/src/components/DsfrFooter/DsfrFooter.types.ts b/src/components/DsfrFooter/DsfrFooter.types.ts
index 730d1f7d..d3b2ac81 100644
--- a/src/components/DsfrFooter/DsfrFooter.types.ts
+++ b/src/components/DsfrFooter/DsfrFooter.types.ts
@@ -24,6 +24,7 @@ export type DsfrFooterLinkProps = {
onClick?: ($event: MouseEvent) => void
to?: RouteLocationRaw
href?: string
+ title?: string
}
export type DsfrFooterLinkListProps = {
@@ -44,15 +45,15 @@ export type DsfrFooterProps = {
descText?: string
beforeMandatoryLinks?: DsfrFooterLinkProps[]
afterMandatoryLinks?: DsfrFooterLinkProps[]
- mandatoryLinks?: { label: string, to: RouteLocationRaw | undefined }[]
- ecosystemLinks?: { label: string, href: string }[]
+ mandatoryLinks?: { label: string, to: RouteLocationRaw | undefined, title?: string }[]
+ ecosystemLinks?: { label: string, href: string, title: string, [key: string]: string }[]
operatorLinkText?: string
operatorTo?: RouteLocationRaw | undefined
operatorImgStyle?: StyleValue
operatorImgSrc?: string
operatorImgAlt?: string
licenceTo?: string
- licenceLinkProps?: { href: string } | { to: RouteLocationRaw | undefined }
+ licenceLinkProps?: ({ href: string } | { to: RouteLocationRaw | undefined }) & Record
licenceText?: string
licenceName?: string
}
diff --git a/src/components/DsfrFooter/DsfrFooter.vue b/src/components/DsfrFooter/DsfrFooter.vue
index 60d8f54c..5abefd1b 100644
--- a/src/components/DsfrFooter/DsfrFooter.vue
+++ b/src/components/DsfrFooter/DsfrFooter.vue
@@ -53,18 +53,22 @@ const props = withDefaults(defineProps(), {
{
label: 'info.gouv.fr',
href: 'https://info.gouv.fr',
+ title: 'Informations gouvernementales, nouvelle fenêtre',
},
{
label: 'service-public.fr',
href: 'https://service-public.fr',
+ title: 'Informations et démarches administratives, nouvelle fenêtre',
},
{
label: 'legifrance.gouv.fr',
href: 'https://legifrance.gouv.fr',
+ title: 'Service public de diffusion du droit, nouvelle fenêtre',
},
{
label: 'data.gouv.fr',
href: 'https://data.gouv.fr',
+ title: 'Plateforme des données publiques, nouvelle fenêtre',
},
],
operatorLinkText: 'Revenir à l’accueil',
@@ -95,6 +99,12 @@ const isExternalLink = computed(() => {
const to = props.licenceTo || (props.licenceLinkProps as { to: RouteLocationRaw }).to
return to && typeof to === 'string' && to.startsWith('http')
})
+
+const licenceLinkAttrs = computed(() => {
+ const { to, href, ...attrs } = props.licenceLinkProps ?? {}
+ return attrs
+})
+
const routerLinkLicenceTo = computed(() => {
return isExternalLink.value ? '' : props.licenceTo
})
@@ -184,17 +194,19 @@ const externalOperatorLink = computed(() => {
@@ -225,11 +237,11 @@ const externalOperatorLink = computed(() => {
{{ licenceName }}
From 712a2593cc99d11eccfa1acf8016c033fafabc42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stanislas=20Ormi=C3=A8res?=
Date: Sun, 15 Sep 2024 13:11:09 +0200
Subject: [PATCH 2/5] =?UTF-8?q?fix(DsfrHeader):=20lien=20homeTo=20m=C3=AAm?=
=?UTF-8?q?e=20sans=20serviceTitle?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
fix #889
---
src/components/DsfrHeader/DsfrHeader.stories.ts | 3 ++-
src/components/DsfrHeader/DsfrHeader.vue | 13 +++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/components/DsfrHeader/DsfrHeader.stories.ts b/src/components/DsfrHeader/DsfrHeader.stories.ts
index 5d22c3a5..289ac115 100644
--- a/src/components/DsfrHeader/DsfrHeader.stories.ts
+++ b/src/components/DsfrHeader/DsfrHeader.stories.ts
@@ -186,9 +186,10 @@ EnTeteSimple.args = {
EnTeteSimple.play = async ({ canvasElement }) => {
const canvas = within(canvasElement)
const links = canvas.getAllByRole('link')
- expect(links).toHaveLength(4)
+ expect(links).toHaveLength(5)
const knownLinks = [
+ { name: '', href: EnTeteSimple.args.homeTo },
{ name: '', href: EnTeteSimple.args.homeTo },
...EnTeteSimple.args.quickLinks.map(({ to }) => ({ href: to })),
]
diff --git a/src/components/DsfrHeader/DsfrHeader.vue b/src/components/DsfrHeader/DsfrHeader.vue
index 279ad60b..17b5672f 100644
--- a/src/components/DsfrHeader/DsfrHeader.vue
+++ b/src/components/DsfrHeader/DsfrHeader.vue
@@ -96,10 +96,15 @@ provide(registerNavigationLinkKey, () => {
Date: Sun, 15 Sep 2024 13:28:17 +0200
Subject: [PATCH 3/5] =?UTF-8?q?fix(DsfrHeaderMenuLink):=20=F0=9F=90=9B=20d?=
=?UTF-8?q?=C3=A9pr=C3=A9cie=20href?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- pour cohérence avec DsfrNavigationMenuLink qui peuvent être intégrés à l’en-tête
---
src/components/DsfrHeader/DsfrHeader.types.ts | 6 ++++++
src/components/DsfrHeader/DsfrHeaderMenuLink.vue | 12 ++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/components/DsfrHeader/DsfrHeader.types.ts b/src/components/DsfrHeader/DsfrHeader.types.ts
index eeffb8e7..4712b343 100644
--- a/src/components/DsfrHeader/DsfrHeader.types.ts
+++ b/src/components/DsfrHeader/DsfrHeader.types.ts
@@ -12,7 +12,13 @@ export type DsfrHeaderMenuLinkProps = {
target?: string
onClick?: ($event: MouseEvent) => void
to?: RouteLocationRaw
+ /**
+ * @deprecated Use the prop `to` instead
+ */
href?: string
+ /**
+ * @deprecated Use the prop `to` instead
+ */
path?: string
}
diff --git a/src/components/DsfrHeader/DsfrHeaderMenuLink.vue b/src/components/DsfrHeader/DsfrHeaderMenuLink.vue
index 938da873..afe50f9f 100644
--- a/src/components/DsfrHeader/DsfrHeaderMenuLink.vue
+++ b/src/components/DsfrHeader/DsfrHeaderMenuLink.vue
@@ -21,10 +21,14 @@ const isPathString = computed(() => {
return typeof props.path === 'string'
})
const isExternalLink = computed(() => {
- return props.href?.startsWith('http') || (isPathString.value && (props.path as string).startsWith('http'))
+ return props.href?.startsWith('http') ||
+ (isPathString.value && (props.path as string).startsWith('http')) ||
+ (typeof props.to === 'string' && (props.to as string).startsWith('http'))
})
const isMailto = computed(() => {
- return props.href?.startsWith('mailto') || (isPathString.value && (props.path as string).startsWith('mailto'))
+ return props.href?.startsWith('mailto') ||
+ (isPathString.value && (props.path as string).startsWith('mailto')) ||
+ (typeof props.to === 'string' && (props.to as string).startsWith('mailto'))
})
const is = computed(() => {
if (props.button) {
@@ -37,13 +41,13 @@ const actualHref = computed(() => {
if (!isExternalLink.value && !isMailto.value) {
return undefined
}
- return props.href !== undefined ? props.href : props.path
+ return props.to ?? props.href ?? props.path
})
const actualTo = computed(() => {
if (isExternalLink.value || isMailto.value) {
return undefined
}
- return props.to || props.path
+ return props.to ?? props.path
})
const linkData = computed(() => {
return actualTo.value ? { to: actualTo.value } : { href: actualHref.value }
From 0fec3e673efae40dfd47698251b2a5f1b3447561 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stanislas=20Ormi=C3=A8res?=
Date: Sun, 15 Sep 2024 13:58:58 +0200
Subject: [PATCH 4/5] =?UTF-8?q?fix(DsfrHeader):=20=F0=9F=90=9B=20bordure?=
=?UTF-8?q?=20en=20haut=20de=20navigation=20principale?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
fix #891
---
demo-app/App.vue | 22 +++++++++----------
src/components/DsfrHeader/DsfrHeader.types.ts | 1 +
src/components/DsfrHeader/DsfrHeader.vue | 22 ++++++++++---------
.../DsfrHeader/docs-demo/DsfrHeaderDemo.vue | 4 ++--
4 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/demo-app/App.vue b/demo-app/App.vue
index 0836e73c..6acf430a 100644
--- a/demo-app/App.vue
+++ b/demo-app/App.vue
@@ -1,10 +1,10 @@