diff --git a/app/[locale]/tag-data.json b/app/[locale]/tag-data.json index 319ea00..e27a4cd 100644 --- a/app/[locale]/tag-data.json +++ b/app/[locale]/tag-data.json @@ -1 +1,43 @@ -{"en":{"markdown":1,"code":1,"features":2,"next-js":7,"math":1,"ols":1,"github":1,"guide":6,"tailwind":4,"i18n":1,"hello":1,"holiday":1,"canada":1,"images":1,"feature":2,"writings":1,"book":1,"reflection":1,"multi-author":1},"fr":{"markdown":1,"code":1,"fonctionnalites":4,"next-js":7,"math":1,"ols":1,"github":1,"guide":6,"tailwind":4,"i18n":1,"salut":1,"vacance":1,"canada":1,"images":1,"ecriture":1,"livre":1,"reflexion":1,"multi-auteurs":1}} \ No newline at end of file +{ + "en": { + "markdown": 1, + "code": 1, + "features": 2, + "next-js": 7, + "math": 1, + "ols": 1, + "github": 1, + "guide": 6, + "tailwind": 4, + "i18n": 1, + "hello": 1, + "holiday": 1, + "canada": 1, + "images": 1, + "feature": 2, + "writings": 1, + "book": 1, + "reflection": 1, + "multi-author": 1 + }, + "fr": { + "markdown": 1, + "code": 1, + "fonctionnalites": 4, + "next-js": 7, + "math": 1, + "ols": 1, + "github": 1, + "guide": 6, + "tailwind": 4, + "i18n": 1, + "salut": 1, + "vacance": 1, + "canada": 1, + "images": 1, + "ecriture": 1, + "livre": 1, + "reflexion": 1, + "multi-auteurs": 1 + } +} diff --git a/components/AuthorsMenu.tsx b/components/AuthorsMenu.tsx index 7bfff41..e345ffd 100644 --- a/components/AuthorsMenu.tsx +++ b/components/AuthorsMenu.tsx @@ -5,7 +5,15 @@ import Link from 'next/link' import siteMetadata from '@/data/siteMetadata' import { Authors, allAuthors } from 'contentlayer/generated' import { Fragment, useRef, useState, useMemo } from 'react' -import { Menu, RadioGroup, Transition } from '@headlessui/react' +import { + Menu, + MenuButton, + MenuItem, + MenuItems, + Radio, + RadioGroup, + Transition, +} from '@headlessui/react' import { useOuterClick } from './util/useOuterClick' import { useParams, usePathname } from 'next/navigation' import { LocaleTypes } from 'app/[locale]/i18n/settings' @@ -24,12 +32,18 @@ const AuthorsMenu = ({ className }: AuthorsMenuProps) => { const lastSection = sections[sections.length - 1] const filterSections = pathname !== `/${locale}` && pathname !== '/' - const authors = useMemo(() => allAuthors - .filter((a) => a.language === locale) - .sort((a, b) => (a.default === b.default ? 0 : a.default ? -1 : 1)), [locale]) as Authors[] + const authors = useMemo( + () => + allAuthors + .filter((a) => a.language === locale) + .sort((a, b) => (a.default === b.default ? 0 : a.default ? -1 : 1)), + [locale] + ) as Authors[] - const mainAuthor = useMemo(() => allAuthors - .filter((a) => a.default === true && a.language === locale), [locale]) as Authors[] + const mainAuthor = useMemo( + () => allAuthors.filter((a) => a.default === true && a.language === locale), + [locale] + ) as Authors[] const [isOpen, setIsOpen] = useState(false) @@ -49,14 +63,12 @@ const AuthorsMenu = ({ className }: AuthorsMenuProps) => { const renderAuthorLink = (author: Authors) => { const { name, avatar, slug } = author return ( - - {({ active }) => ( - + + + {({ active }) => (
@@ -73,9 +85,9 @@ const AuthorsMenu = ({ className }: AuthorsMenuProps) => { {name}
- - )} - + )} + + ) } @@ -85,7 +97,7 @@ const AuthorsMenu = ({ className }: AuthorsMenuProps) => {
- @@ -105,7 +117,7 @@ const AuthorsMenu = ({ className }: AuthorsMenuProps) => { > )}
- +
{ leaveFrom="opacity-100 scale-100 translate-y-0" leaveTo="opacity-0 scale-95 translate-y-[10px]" > -
- {authors.map((author) => author.language === locale && renderAuthorLink(author))} + {authors.map( + (author) => author.language === locale && renderAuthorLink(author) + )}
-
+
diff --git a/components/Header.tsx b/components/Header.tsx index 88ed82a..38391e8 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -52,20 +52,20 @@ const Header = () => { className="flex transform-gpu items-center space-x-1 transition-transform duration-300" >
- {t(`${link.title.toLowerCase()}`)} - {isSelected && ( - - )} + className={`hidden font-medium ${ + isSelected + ? 'text-heading-500' + : 'text-gray-500 hover:text-gray-900 dark:hover:text-gray-100' + } relative rounded-md px-2 py-1 font-medium transition-colors sm:block`} + > + {t(`${link.title.toLowerCase()}`)} + {isSelected && ( + + )}
) diff --git a/components/theme/ThemeSwitch.tsx b/components/theme/ThemeSwitch.tsx index ca0d9e7..9e22591 100644 --- a/components/theme/ThemeSwitch.tsx +++ b/components/theme/ThemeSwitch.tsx @@ -2,7 +2,15 @@ import * as React from 'react' import { Fragment } from 'react' -import { Menu, RadioGroup, Transition } from '@headlessui/react' +import { + Menu, + MenuButton, + MenuItem, + MenuItems, + Radio, + RadioGroup, + Transition, +} from '@headlessui/react' import { DarkModeSwitch } from './DarkModeSwitch' import { Monitor, Moon, Sun } from './icons' import { useTheme } from './ThemeContext' @@ -35,14 +43,14 @@ const ThemeSwitch = () => { return (
- + setDarkModeChecked(isChecked)} onClick={() => setMenuOpen(!menuOpen)} size={24} /> - + { leaveFrom="opacity-100 scale-100 translate-y-0" leaveTo="opacity-0 scale-95 translate-y-[10px]" > - +
- - + + {({ active }) => ( )} - - - - + + + + {({ active }) => ( )} - - - - + + + + {({ active }) => ( )} - - + +
-
+
diff --git a/package.json b/package.json index a4b6a04..01795b6 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@formspree/react": "^2.5.1", - "@headlessui/react": "^1.7.19", + "@headlessui/react": "v2.0.4", "@next/bundle-analyzer": "14.2.3", "@tailwindcss/forms": "^0.5.7", "@tailwindcss/typography": "^0.5.12", diff --git a/yarn.lock b/yarn.lock index 5a23d0f..d3dd063 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2279,6 +2279,58 @@ __metadata: languageName: node linkType: hard +"@floating-ui/core@npm:^1.0.0": + version: 1.6.2 + resolution: "@floating-ui/core@npm:1.6.2" + dependencies: + "@floating-ui/utils": "npm:^0.2.0" + checksum: 5c940ef3d397aa23f859ecb033bda408dde20820af3f82090a889c35a99826cfaa7864e8131b9906a26b2c04f31fa468538a28d0715b34de541e0776e0f82d03 + languageName: node + linkType: hard + +"@floating-ui/dom@npm:^1.0.0": + version: 1.6.5 + resolution: "@floating-ui/dom@npm:1.6.5" + dependencies: + "@floating-ui/core": "npm:^1.0.0" + "@floating-ui/utils": "npm:^0.2.0" + checksum: d421e7f239e9af5a2a4c7a560c29b8ce1f29398c411c8e3bd0c33a2ce800e13a378749a1606e4f6b460830f4007c459792534821013262d24d1385476b1ba48d + languageName: node + linkType: hard + +"@floating-ui/react-dom@npm:^2.1.0": + version: 2.1.0 + resolution: "@floating-ui/react-dom@npm:2.1.0" + dependencies: + "@floating-ui/dom": "npm:^1.0.0" + peerDependencies: + react: ">=16.8.0" + react-dom: ">=16.8.0" + checksum: 15be0714379c271ff01347e7c9bcdba96d6b39f3960697380e23de9b9d59fb91ba07bc75b8bdb12d72da7a9272191a9ce73f843a0d5f89939caa9f3137acd8ec + languageName: node + linkType: hard + +"@floating-ui/react@npm:^0.26.13": + version: 0.26.17 + resolution: "@floating-ui/react@npm:0.26.17" + dependencies: + "@floating-ui/react-dom": "npm:^2.1.0" + "@floating-ui/utils": "npm:^0.2.0" + tabbable: "npm:^6.0.0" + peerDependencies: + react: ">=16.8.0" + react-dom: ">=16.8.0" + checksum: bceabe5a2f515fffaae85b4f652cc3ab8f9066ae09e8d094308932321454340465fa3b2605a0a38a2e999f31e4edf3ed5b741c4656a9a7996b5fb7ad732a5da2 + languageName: node + linkType: hard + +"@floating-ui/utils@npm:^0.2.0": + version: 0.2.2 + resolution: "@floating-ui/utils@npm:0.2.2" + checksum: 28d900d2f0876b40c7090f55724700eeac608862e59110b7b14731223218cf7ce125b2091f34103edf4b0f779166151bbca21256b856236235a2be996548ed38 + languageName: node + linkType: hard + "@formspree/core@npm:^3.0.1": version: 3.0.1 resolution: "@formspree/core@npm:3.0.1" @@ -2338,16 +2390,18 @@ __metadata: languageName: node linkType: hard -"@headlessui/react@npm:^1.7.19": - version: 1.7.19 - resolution: "@headlessui/react@npm:1.7.19" +"@headlessui/react@npm:v2.0.4": + version: 2.0.4 + resolution: "@headlessui/react@npm:2.0.4" dependencies: - "@tanstack/react-virtual": "npm:^3.0.0-beta.60" - client-only: "npm:^0.0.1" + "@floating-ui/react": "npm:^0.26.13" + "@react-aria/focus": "npm:^3.16.2" + "@react-aria/interactions": "npm:^3.21.1" + "@tanstack/react-virtual": "npm:3.5.0" peerDependencies: - react: ^16 || ^17 || ^18 - react-dom: ^16 || ^17 || ^18 - checksum: 682dddfb53e4dc1e457f47fa3ee3a35ad02255b552eec90e703a2b4cb6b07428da7c392844c24ac846e8061cd0fb840e1933b6b91b5416fde3d2648f075a6765 + react: ^18 + react-dom: ^18 + checksum: 1419c35eccfce133b8daafa786fa66fc8271dfbc696458679fb24acaf74e7646e57228e36e69c512891e44a05b845ae3c151dc7bff27e6fb56fa74aadd3ecb48 languageName: node linkType: hard @@ -3210,6 +3264,61 @@ __metadata: languageName: node linkType: hard +"@react-aria/focus@npm:^3.16.2": + version: 3.17.1 + resolution: "@react-aria/focus@npm:3.17.1" + dependencies: + "@react-aria/interactions": "npm:^3.21.3" + "@react-aria/utils": "npm:^3.24.1" + "@react-types/shared": "npm:^3.23.1" + "@swc/helpers": "npm:^0.5.0" + clsx: "npm:^2.0.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + checksum: 4c3c7b26c983c83119a5ff1595e339b8bf68dcb6ea4349dc3b6bb26af41bbae4be50df8a96b12beea9b9f700c4508addfa4fd4626e7955bce667ec7620693af8 + languageName: node + linkType: hard + +"@react-aria/interactions@npm:^3.21.1, @react-aria/interactions@npm:^3.21.3": + version: 3.21.3 + resolution: "@react-aria/interactions@npm:3.21.3" + dependencies: + "@react-aria/ssr": "npm:^3.9.4" + "@react-aria/utils": "npm:^3.24.1" + "@react-types/shared": "npm:^3.23.1" + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + checksum: 84fe368a40631f02fb9b9fcc103820a7659132b74a029a3bac3939f4a8bee05c9fe1f023f2d170760adaf3cc110793c6b8db396f016bab740922ffc823f99833 + languageName: node + linkType: hard + +"@react-aria/ssr@npm:^3.9.4": + version: 3.9.4 + resolution: "@react-aria/ssr@npm:3.9.4" + dependencies: + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + checksum: c55e5e0bf86bc39c7c0c9f86f4166e923cf62304903b7b5e700619bff64edc4fbeec5a66741aa39635445ff0b26d80ee03d6471c5df02ec764b9a71938dd17de + languageName: node + linkType: hard + +"@react-aria/utils@npm:^3.24.1": + version: 3.24.1 + resolution: "@react-aria/utils@npm:3.24.1" + dependencies: + "@react-aria/ssr": "npm:^3.9.4" + "@react-stately/utils": "npm:^3.10.1" + "@react-types/shared": "npm:^3.23.1" + "@swc/helpers": "npm:^0.5.0" + clsx: "npm:^2.0.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + checksum: 7acf52f3cdf66aaa0c55bde86959a3772bc266682389bf19865739ca8b77a652db8d9f970dc37600c69b8a7cce78b821913f3d7f066bdcb1224599e3fe35afce + languageName: node + linkType: hard + "@react-spring/animated@npm:~9.7.3": version: 9.7.3 resolution: "@react-spring/animated@npm:9.7.3" @@ -3332,6 +3441,26 @@ __metadata: languageName: node linkType: hard +"@react-stately/utils@npm:^3.10.1": + version: 3.10.1 + resolution: "@react-stately/utils@npm:3.10.1" + dependencies: + "@swc/helpers": "npm:^0.5.0" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + checksum: b3fc1367eb26afa1d7a4e3d5cf5cf215be4a4698296db25d34a9096a9eb79cff5c3770da48989970e6b6734199bfb9a10c31cd62a39b20980b2ede78061f8ee9 + languageName: node + linkType: hard + +"@react-types/shared@npm:^3.23.1": + version: 3.23.1 + resolution: "@react-types/shared@npm:3.23.1" + peerDependencies: + react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 + checksum: 1ea30702a408554e45b827e66ebf2a9674aec7d7d04a4f3723f2fe1c677be36701d5f08d4914d6018c4bcb6f2fe07d8c3a5840dfe3299ee69092b78c723c9c03 + languageName: node + linkType: hard + "@rushstack/eslint-patch@npm:^1.3.3": version: 1.10.2 resolution: "@rushstack/eslint-patch@npm:1.10.2" @@ -3532,6 +3661,15 @@ __metadata: languageName: node linkType: hard +"@swc/helpers@npm:^0.5.0": + version: 0.5.11 + resolution: "@swc/helpers@npm:0.5.11" + dependencies: + tslib: "npm:^2.4.0" + checksum: 54d66ade8010e6ba526a9d73b8bcdbb01c806a24f2d3786640ef3081065e8fba398d9b890df4847744c33d086412fd9a6570b5e99e8001ea1462efc5ce0f3847 + languageName: node + linkType: hard + "@tailwindcss/forms@npm:^0.5.7": version: 0.5.7 resolution: "@tailwindcss/forms@npm:0.5.7" @@ -3557,22 +3695,22 @@ __metadata: languageName: node linkType: hard -"@tanstack/react-virtual@npm:^3.0.0-beta.60": - version: 3.4.0 - resolution: "@tanstack/react-virtual@npm:3.4.0" +"@tanstack/react-virtual@npm:3.5.0": + version: 3.5.0 + resolution: "@tanstack/react-virtual@npm:3.5.0" dependencies: - "@tanstack/virtual-core": "npm:3.4.0" + "@tanstack/virtual-core": "npm:3.5.0" peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - checksum: 73c272d4a6242d1e49e37e56cec3985d8ff3108e8cd33d2f0c8c3f6ec3d84fece50813e875ee15ee025de4c47f051fcdf8829b1a9c824fd360ae0a569eddb1f5 + checksum: ecb1424b9961ada3c7516b8f05a1bb37fb1b75cb88035e06530a9365e4e565e701b5de9668c17f727bbcb3be1bbe6482f7bd37af9e0b144846e5a67fc9dfd57d languageName: node linkType: hard -"@tanstack/virtual-core@npm:3.4.0": - version: 3.4.0 - resolution: "@tanstack/virtual-core@npm:3.4.0" - checksum: b4fe50c36dd5d9e4998c154323e777a027216296bf862faf73eaa357144e2b33f6298732e5bf7f8d9a151d2d65d3488872f767276c7630f245dbabfb034fc0fc +"@tanstack/virtual-core@npm:3.5.0": + version: 3.5.0 + resolution: "@tanstack/virtual-core@npm:3.5.0" + checksum: 76a37734118c59f992bfdd540bb5900aa30d040c723909312c1e7071af1619da6ddedabba1834802fee7e0f6497c38d0fe8bc70ab4950d2d09342558b5c89bb2 languageName: node linkType: hard @@ -4851,7 +4989,7 @@ __metadata: languageName: node linkType: hard -"client-only@npm:0.0.1, client-only@npm:^0.0.1": +"client-only@npm:0.0.1": version: 0.0.1 resolution: "client-only@npm:0.0.1" checksum: 0c16bf660dadb90610553c1d8946a7fdfb81d624adea073b8440b7d795d5b5b08beb3c950c6a2cf16279365a3265158a236876d92bce16423c485c322d7dfaf8 @@ -4891,6 +5029,13 @@ __metadata: languageName: node linkType: hard +"clsx@npm:^2.0.0": + version: 2.1.1 + resolution: "clsx@npm:2.1.1" + checksum: cdfb57fa6c7649bbff98d9028c2f0de2f91c86f551179541cf784b1cfdc1562dcb951955f46d54d930a3879931a980e32a46b598acaea274728dbe068deca919 + languageName: node + linkType: hard + "collapse-white-space@npm:^2.0.0": version: 2.1.0 resolution: "collapse-white-space@npm:2.1.0" @@ -11725,12 +11870,19 @@ __metadata: languageName: node linkType: hard +"tabbable@npm:^6.0.0": + version: 6.2.0 + resolution: "tabbable@npm:6.2.0" + checksum: 980fa73476026e99dcacfc0d6e000d41d42c8e670faf4682496d30c625495e412c4369694f2a15cf1e5252d22de3c396f2b62edbe8d60b5dadc40d09e3f2dde3 + languageName: node + linkType: hard + "tailwind-nextjs-starter-blog-i18n@workspace:.": version: 0.0.0-use.local resolution: "tailwind-nextjs-starter-blog-i18n@workspace:." dependencies: "@formspree/react": "npm:^2.5.1" - "@headlessui/react": "npm:^1.7.19" + "@headlessui/react": "npm:v2.0.4" "@next/bundle-analyzer": "npm:14.2.3" "@svgr/webpack": "npm:^8.1.0" "@tailwindcss/forms": "npm:^0.5.7"