From 65f266411df88031eb87f4308d16c39cb6057990 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Thu, 8 Aug 2024 11:04:49 +0200 Subject: [PATCH] Actually address #286 #233 #183 --- src/Header/Header.tsx | 30 +++++++++++----------- test/integration/cra/yarn.lock | 12 ++++----- test/integration/next-appdir/yarn.lock | 12 ++++----- test/integration/next-pagesdir/yarn.lock | 12 ++++----- test/integration/vite/index.html | 32 ++++++++++++------------ test/integration/vite/yarn.lock | 12 ++++----- 6 files changed, 56 insertions(+), 54 deletions(-) diff --git a/src/Header/Header.tsx b/src/Header/Header.tsx index ba652367e..85adb1438 100644 --- a/src/Header/Header.tsx +++ b/src/Header/Header.tsx @@ -1,3 +1,4 @@ +/* eslint-disable no-inner-declarations */ import React, { memo, forwardRef, @@ -173,7 +174,15 @@ export const Header = memo( } return cloneElement(node, { - "id": `${id}-quick-access-item-${i}-${usecase}` + "id": `${id}-quick-access-item-${i}${(() => { + switch (usecase) { + case "mobile": + return "-mobile"; + case "desktop": + return ""; + } + assert>(); + })()}` }); })()} @@ -486,42 +495,35 @@ addHeaderTranslations({ export type HeaderQuickAccessItemProps = { className?: string; quickAccessItem: HeaderProps.QuickAccessItem; + id?: string; }; export function HeaderQuickAccessItem(props: HeaderQuickAccessItemProps): JSX.Element { - const { className, quickAccessItem } = props; + const { className, quickAccessItem, id } = props; const { Link } = getLink(); return quickAccessItem.linkProps !== undefined ? ( { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { id, ...rest } = quickAccessItem.linkProps; - - return rest; - })()} + {...quickAccessItem.linkProps} className={cx( fr.cx("fr-btn", quickAccessItem.iconId), quickAccessItem.linkProps.className, className )} + id={id} > {quickAccessItem.text} ) : ( diff --git a/test/integration/cra/yarn.lock b/test/integration/cra/yarn.lock index 24845a200..d4769e064 100644 --- a/test/integration/cra/yarn.lock +++ b/test/integration/cra/yarn.lock @@ -1110,9 +1110,9 @@ integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== "@codegouvfr/react-dsfr@file:../../../dist": - version "1.6.0" + version "1.10.11" dependencies: - tsafe "^1.6.3" + tsafe "^1.7.2" yargs-parser "^21.1.1" "@csstools/normalize.css@*": @@ -8504,10 +8504,10 @@ tryer@^1.0.1: resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== -tsafe@^1.6.3: - version "1.6.3" - resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.3.tgz#93a77510f542d9043c6f3ab9ed46267729431a59" - integrity sha512-55Tbbxn6XAx1NX7X+fNfIsKsM6XxcbFbUMZ47fjXlef1g9jV8w+mZi3rse0+9Dj5nQefyWLeYT4cAwyiakWszQ== +tsafe@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.2.tgz#0f63d414876287ad01b135f832722f93e22da374" + integrity sha512-dAPfQLhCfCRre5qs+Z5Q2a7s2CV7RxffZUmvj7puGaePYjECzWREJFd3w4XSFe/T5tbxgowfItA/JSSZ6Ma3dA== tsconfig-paths@^3.14.1: version "3.14.1" diff --git a/test/integration/next-appdir/yarn.lock b/test/integration/next-appdir/yarn.lock index fd00ce240..1499b3fc1 100644 --- a/test/integration/next-appdir/yarn.lock +++ b/test/integration/next-appdir/yarn.lock @@ -86,9 +86,9 @@ to-fast-properties "^2.0.0" "@codegouvfr/react-dsfr@file:../../../dist": - version "1.6.0" + version "1.10.11" dependencies: - tsafe "^1.6.3" + tsafe "^1.7.2" yargs-parser "^21.1.1" "@emotion/babel-plugin@^11.10.5": @@ -2481,10 +2481,10 @@ tsafe@^1.4.1: resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.4.1.tgz#59cdad8ac41babf88e56dcd1a683ae2fb145d059" integrity sha512-3IDBalvf6SyvHFS14UiwCWzqdSdo+Q0k2J7DZyJYaHW/iraW9DJpaBKDJpry3yQs3o/t/A+oGaRW3iVt2lKxzA== -tsafe@^1.6.3: - version "1.6.3" - resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.3.tgz#93a77510f542d9043c6f3ab9ed46267729431a59" - integrity sha512-55Tbbxn6XAx1NX7X+fNfIsKsM6XxcbFbUMZ47fjXlef1g9jV8w+mZi3rse0+9Dj5nQefyWLeYT4cAwyiakWszQ== +tsafe@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.2.tgz#0f63d414876287ad01b135f832722f93e22da374" + integrity sha512-dAPfQLhCfCRre5qs+Z5Q2a7s2CV7RxffZUmvj7puGaePYjECzWREJFd3w4XSFe/T5tbxgowfItA/JSSZ6Ma3dA== tsconfig-paths@^3.14.1: version "3.14.1" diff --git a/test/integration/next-pagesdir/yarn.lock b/test/integration/next-pagesdir/yarn.lock index 14dd559f7..19b11f2f1 100644 --- a/test/integration/next-pagesdir/yarn.lock +++ b/test/integration/next-pagesdir/yarn.lock @@ -86,9 +86,9 @@ to-fast-properties "^2.0.0" "@codegouvfr/react-dsfr@file:../../../dist": - version "1.6.0" + version "1.10.11" dependencies: - tsafe "^1.6.3" + tsafe "^1.7.2" yargs-parser "^21.1.1" "@emotion/babel-plugin@^11.10.5": @@ -2391,10 +2391,10 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tsafe@^1.6.3: - version "1.6.3" - resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.3.tgz#93a77510f542d9043c6f3ab9ed46267729431a59" - integrity sha512-55Tbbxn6XAx1NX7X+fNfIsKsM6XxcbFbUMZ47fjXlef1g9jV8w+mZi3rse0+9Dj5nQefyWLeYT4cAwyiakWszQ== +tsafe@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.2.tgz#0f63d414876287ad01b135f832722f93e22da374" + integrity sha512-dAPfQLhCfCRre5qs+Z5Q2a7s2CV7RxffZUmvj7puGaePYjECzWREJFd3w4XSFe/T5tbxgowfItA/JSSZ6Ma3dA== tsconfig-paths@^3.14.1: version "3.14.1" diff --git a/test/integration/vite/index.html b/test/integration/vite/index.html index e14d2b0b9..93b56e137 100644 --- a/test/integration/vite/index.html +++ b/test/integration/vite/index.html @@ -6,24 +6,24 @@ - - - - + + + + - - - - - - - - - - + + + + + + + + + + - - + + Vite + React + TS diff --git a/test/integration/vite/yarn.lock b/test/integration/vite/yarn.lock index 57068a97e..6bdf4196d 100644 --- a/test/integration/vite/yarn.lock +++ b/test/integration/vite/yarn.lock @@ -257,9 +257,9 @@ to-fast-properties "^2.0.0" "@codegouvfr/react-dsfr@file:../../../dist": - version "1.6.0" + version "1.10.11" dependencies: - tsafe "^1.6.3" + tsafe "^1.7.2" yargs-parser "^21.1.1" "@emotion/babel-plugin@^11.11.0": @@ -1195,10 +1195,10 @@ to-fast-properties@^2.0.0: resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== -tsafe@^1.6.3: - version "1.6.3" - resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.6.3.tgz#93a77510f542d9043c6f3ab9ed46267729431a59" - integrity sha512-55Tbbxn6XAx1NX7X+fNfIsKsM6XxcbFbUMZ47fjXlef1g9jV8w+mZi3rse0+9Dj5nQefyWLeYT4cAwyiakWszQ== +tsafe@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-1.7.2.tgz#0f63d414876287ad01b135f832722f93e22da374" + integrity sha512-dAPfQLhCfCRre5qs+Z5Q2a7s2CV7RxffZUmvj7puGaePYjECzWREJFd3w4XSFe/T5tbxgowfItA/JSSZ6Ma3dA== typescript@^4.6.4: version "4.9.5"