Skip to content

Commit 65f2664

Browse files
committed
Actually address #286 #233 #183
1 parent 36e683d commit 65f2664

File tree

6 files changed

+56
-54
lines changed

6 files changed

+56
-54
lines changed

src/Header/Header.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-inner-declarations */
12
import React, {
23
memo,
34
forwardRef,
@@ -173,7 +174,15 @@ export const Header = memo(
173174
}
174175

175176
return cloneElement(node, {
176-
"id": `${id}-quick-access-item-${i}-${usecase}`
177+
"id": `${id}-quick-access-item-${i}${(() => {
178+
switch (usecase) {
179+
case "mobile":
180+
return "-mobile";
181+
case "desktop":
182+
return "";
183+
}
184+
assert<Equals<typeof usecase, never>>();
185+
})()}`
177186
});
178187
})()}
179188
</li>
@@ -486,42 +495,35 @@ addHeaderTranslations({
486495
export type HeaderQuickAccessItemProps = {
487496
className?: string;
488497
quickAccessItem: HeaderProps.QuickAccessItem;
498+
id?: string;
489499
};
490500

491501
export function HeaderQuickAccessItem(props: HeaderQuickAccessItemProps): JSX.Element {
492-
const { className, quickAccessItem } = props;
502+
const { className, quickAccessItem, id } = props;
493503

494504
const { Link } = getLink();
495505

496506
return quickAccessItem.linkProps !== undefined ? (
497507
<Link
498-
{...(() => {
499-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
500-
const { id, ...rest } = quickAccessItem.linkProps;
501-
502-
return rest;
503-
})()}
508+
{...quickAccessItem.linkProps}
504509
className={cx(
505510
fr.cx("fr-btn", quickAccessItem.iconId),
506511
quickAccessItem.linkProps.className,
507512
className
508513
)}
514+
id={id}
509515
>
510516
{quickAccessItem.text}
511517
</Link>
512518
) : (
513519
<button
514-
{...(() => {
515-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
516-
const { id, ...rest } = quickAccessItem.buttonProps;
517-
518-
return rest;
519-
})()}
520+
{...quickAccessItem.buttonProps}
520521
className={cx(
521522
fr.cx("fr-btn", quickAccessItem.iconId),
522523
quickAccessItem.buttonProps.className,
523524
className
524525
)}
526+
id={id}
525527
>
526528
{quickAccessItem.text}
527529
</button>

test/integration/cra/yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,9 @@
11101110
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
11111111

11121112
"@codegouvfr/react-dsfr@file:../../../dist":
1113-
version "1.6.0"
1113+
version "1.10.11"
11141114
dependencies:
1115-
tsafe "^1.6.3"
1115+
tsafe "^1.7.2"
11161116
yargs-parser "^21.1.1"
11171117

11181118
"@csstools/normalize.css@*":
@@ -8504,10 +8504,10 @@ tryer@^1.0.1:
85048504
resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8"
85058505
integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==
85068506

8507-
tsafe@^1.6.3:
8508-
version "1.6.3"
8509-
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.3.tgz#93a77510f542d9043c6f3ab9ed46267729431a59"
8510-
integrity sha512-55Tbbxn6XAx1NX7X+fNfIsKsM6XxcbFbUMZ47fjXlef1g9jV8w+mZi3rse0+9Dj5nQefyWLeYT4cAwyiakWszQ==
8507+
tsafe@^1.7.2:
8508+
version "1.7.2"
8509+
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.2.tgz#0f63d414876287ad01b135f832722f93e22da374"
8510+
integrity sha512-dAPfQLhCfCRre5qs+Z5Q2a7s2CV7RxffZUmvj7puGaePYjECzWREJFd3w4XSFe/T5tbxgowfItA/JSSZ6Ma3dA==
85118511

85128512
tsconfig-paths@^3.14.1:
85138513
version "3.14.1"

test/integration/next-appdir/yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@
8686
to-fast-properties "^2.0.0"
8787

8888
"@codegouvfr/react-dsfr@file:../../../dist":
89-
version "1.6.0"
89+
version "1.10.11"
9090
dependencies:
91-
tsafe "^1.6.3"
91+
tsafe "^1.7.2"
9292
yargs-parser "^21.1.1"
9393

9494
"@emotion/babel-plugin@^11.10.5":
@@ -2481,10 +2481,10 @@ tsafe@^1.4.1:
24812481
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.4.1.tgz#59cdad8ac41babf88e56dcd1a683ae2fb145d059"
24822482
integrity sha512-3IDBalvf6SyvHFS14UiwCWzqdSdo+Q0k2J7DZyJYaHW/iraW9DJpaBKDJpry3yQs3o/t/A+oGaRW3iVt2lKxzA==
24832483

2484-
tsafe@^1.6.3:
2485-
version "1.6.3"
2486-
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.3.tgz#93a77510f542d9043c6f3ab9ed46267729431a59"
2487-
integrity sha512-55Tbbxn6XAx1NX7X+fNfIsKsM6XxcbFbUMZ47fjXlef1g9jV8w+mZi3rse0+9Dj5nQefyWLeYT4cAwyiakWszQ==
2484+
tsafe@^1.7.2:
2485+
version "1.7.2"
2486+
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.2.tgz#0f63d414876287ad01b135f832722f93e22da374"
2487+
integrity sha512-dAPfQLhCfCRre5qs+Z5Q2a7s2CV7RxffZUmvj7puGaePYjECzWREJFd3w4XSFe/T5tbxgowfItA/JSSZ6Ma3dA==
24882488

24892489
tsconfig-paths@^3.14.1:
24902490
version "3.14.1"

test/integration/next-pagesdir/yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@
8686
to-fast-properties "^2.0.0"
8787

8888
"@codegouvfr/react-dsfr@file:../../../dist":
89-
version "1.6.0"
89+
version "1.10.11"
9090
dependencies:
91-
tsafe "^1.6.3"
91+
tsafe "^1.7.2"
9292
yargs-parser "^21.1.1"
9393

9494
"@emotion/babel-plugin@^11.10.5":
@@ -2391,10 +2391,10 @@ to-regex-range@^5.0.1:
23912391
dependencies:
23922392
is-number "^7.0.0"
23932393

2394-
tsafe@^1.6.3:
2395-
version "1.6.3"
2396-
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.3.tgz#93a77510f542d9043c6f3ab9ed46267729431a59"
2397-
integrity sha512-55Tbbxn6XAx1NX7X+fNfIsKsM6XxcbFbUMZ47fjXlef1g9jV8w+mZi3rse0+9Dj5nQefyWLeYT4cAwyiakWszQ==
2394+
tsafe@^1.7.2:
2395+
version "1.7.2"
2396+
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.2.tgz#0f63d414876287ad01b135f832722f93e22da374"
2397+
integrity sha512-dAPfQLhCfCRre5qs+Z5Q2a7s2CV7RxffZUmvj7puGaePYjECzWREJFd3w4XSFe/T5tbxgowfItA/JSSZ6Ma3dA==
23982398

23992399
tsconfig-paths@^3.14.1:
24002400
version "3.14.1"

test/integration/vite/index.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
<meta http-equiv="Content-Security-Policy"
77
content="require-trusted-types-for 'script'; trusted-types react-dsfr react-dsfr-asap" />
88

9-
<link rel="apple-touch-icon" href="/dsfr/favicon/apple-touch-icon.png" />
10-
<link rel="icon" href="/dsfr/favicon/favicon.svg" type="image/svg+xml" />
11-
<link rel="shortcut icon" href="/dsfr/favicon/favicon.ico" type="image/x-icon" />
12-
<link rel="manifest" href="/dsfr/favicon/manifest.webmanifest" crossorigin="use-credentials" />
9+
<link rel="apple-touch-icon" href="/dsfr/favicon/apple-touch-icon.png?v=1.12.1" />
10+
<link rel="icon" href="/dsfr/favicon/favicon.svg?v=1.12.1" type="image/svg+xml" />
11+
<link rel="shortcut icon" href="/dsfr/favicon/favicon.ico?v=1.12.1" type="image/x-icon" />
12+
<link rel="manifest" href="/dsfr/favicon/manifest.webmanifest?v=1.12.1" crossorigin="use-credentials" />
1313

14-
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Light.woff2" as="font" crossorigin="anonymous" />-->
15-
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Light_Italic.woff2" as="font" crossorigin="anonymous" />-->
16-
<link rel="preload" href="/dsfr/fonts/Marianne-Regular.woff2" as="font" crossorigin="anonymous" />
17-
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Regular_Italic.woff2" as="font" crossorigin="anonymous" />-->
18-
<link rel="preload" href="/dsfr/fonts/Marianne-Medium.woff2" as="font" crossorigin="anonymous" />
19-
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Medium_Italic.woff2" as="font" crossorigin="anonymous" />-->
20-
<link rel="preload" href="/dsfr/fonts/Marianne-Bold.woff2" as="font" crossorigin="anonymous" />
21-
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Bold_Italic.woff2" as="font" crossorigin="anonymous" />-->
22-
<!--<link rel="preload" href="/dsfr/fonts/Spectral-Regular.woff2" as="font" crossorigin="anonymous" />-->
23-
<!--<link rel="preload" href="/dsfr/fonts/Spectral-ExtraBold.woff2" as="font" crossorigin="anonymous" />-->
14+
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Light.woff2?v=1.12.1" as="font" crossorigin="anonymous" />-->
15+
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Light_Italic.woff2?v=1.12.1" as="font" crossorigin="anonymous" />-->
16+
<link rel="preload" href="/dsfr/fonts/Marianne-Regular.woff2?v=1.12.1" as="font" crossorigin="anonymous" />
17+
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Regular_Italic.woff2?v=1.12.1" as="font" crossorigin="anonymous" />-->
18+
<link rel="preload" href="/dsfr/fonts/Marianne-Medium.woff2?v=1.12.1" as="font" crossorigin="anonymous" />
19+
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Medium_Italic.woff2?v=1.12.1" as="font" crossorigin="anonymous" />-->
20+
<link rel="preload" href="/dsfr/fonts/Marianne-Bold.woff2?v=1.12.1" as="font" crossorigin="anonymous" />
21+
<!--<link rel="preload" href="/dsfr/fonts/Marianne-Bold_Italic.woff2?v=1.12.1" as="font" crossorigin="anonymous" />-->
22+
<!--<link rel="preload" href="/dsfr/fonts/Spectral-Regular.woff2?v=1.12.1" as="font" crossorigin="anonymous" />-->
23+
<!--<link rel="preload" href="/dsfr/fonts/Spectral-ExtraBold.woff2?v=1.12.1" as="font" crossorigin="anonymous" />-->
2424

25-
<link rel="stylesheet" href="/dsfr/utility/icons/icons.min.css" />
26-
<link rel="stylesheet" href="/dsfr/dsfr.min.css" />
25+
<link rel="stylesheet" href="/dsfr/utility/icons/icons.min.css?hash=bd03f648" />
26+
<link rel="stylesheet" href="/dsfr/dsfr.min.css?v=1.12.1" />
2727

2828
<title>Vite + React + TS</title>
2929
</head>

test/integration/vite/yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@
257257
to-fast-properties "^2.0.0"
258258

259259
"@codegouvfr/react-dsfr@file:../../../dist":
260-
version "1.6.0"
260+
version "1.10.11"
261261
dependencies:
262-
tsafe "^1.6.3"
262+
tsafe "^1.7.2"
263263
yargs-parser "^21.1.1"
264264

265265
"@emotion/babel-plugin@^11.11.0":
@@ -1195,10 +1195,10 @@ to-fast-properties@^2.0.0:
11951195
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
11961196
integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==
11971197

1198-
tsafe@^1.6.3:
1199-
version "1.6.3"
1200-
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.3.tgz#93a77510f542d9043c6f3ab9ed46267729431a59"
1201-
integrity sha512-55Tbbxn6XAx1NX7X+fNfIsKsM6XxcbFbUMZ47fjXlef1g9jV8w+mZi3rse0+9Dj5nQefyWLeYT4cAwyiakWszQ==
1198+
tsafe@^1.7.2:
1199+
version "1.7.2"
1200+
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.2.tgz#0f63d414876287ad01b135f832722f93e22da374"
1201+
integrity sha512-dAPfQLhCfCRre5qs+Z5Q2a7s2CV7RxffZUmvj7puGaePYjECzWREJFd3w4XSFe/T5tbxgowfItA/JSSZ6Ma3dA==
12021202

12031203
typescript@^4.6.4:
12041204
version "4.9.5"

0 commit comments

Comments
 (0)