From ebd8eec3563ffaf2ebe525939e90be1c553310f7 Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Fri, 18 Apr 2025 11:49:54 +0200 Subject: [PATCH] style: Update variable declarations to use const --- app/components/syntax/HeroBackground.tsx | 2 +- app/components/syntax/Icon.tsx | 2 +- app/components/syntax/Logo.tsx | 28 ++-------------------- app/components/syntax/MobileNavigation.tsx | 9 +++---- app/components/syntax/Navigation.tsx | 2 +- app/components/syntax/PrevNextLinks.tsx | 1 + app/components/syntax/Prose.tsx | 2 +- 7 files changed, 12 insertions(+), 34 deletions(-) diff --git a/app/components/syntax/HeroBackground.tsx b/app/components/syntax/HeroBackground.tsx index 82a7688..5385d69 100644 --- a/app/components/syntax/HeroBackground.tsx +++ b/app/components/syntax/HeroBackground.tsx @@ -1,4 +1,4 @@ -import { useId } from "react"; +import React, { useId } from "react"; export function HeroBackground(props: React.ComponentPropsWithoutRef<"svg">) { const id = useId(); diff --git a/app/components/syntax/Icon.tsx b/app/components/syntax/Icon.tsx index e5c3fde..2af0a22 100644 --- a/app/components/syntax/Icon.tsx +++ b/app/components/syntax/Icon.tsx @@ -5,7 +5,7 @@ import { PluginsIcon } from "@syntax/icons/PluginsIcon"; import { PresetsIcon } from "@syntax/icons/PresetsIcon"; import { ThemingIcon } from "@syntax/icons/ThemingIcon"; import { WarningIcon } from "@syntax/icons/WarningIcon"; -import { useId } from "react"; +import React, { useId } from "react"; import clsx from "clsx"; const icons = { diff --git a/app/components/syntax/Logo.tsx b/app/components/syntax/Logo.tsx index c7e787e..174c2d3 100644 --- a/app/components/syntax/Logo.tsx +++ b/app/components/syntax/Logo.tsx @@ -1,11 +1,6 @@ -function LogomarkPaths() { - // return ( - // - // - // - // - // ); +import React from "react"; +function LogomarkPaths() { return ( <> @@ -33,25 +28,6 @@ function LogomarkPaths() { ); } -export function LogoWithText(props: React.ComponentPropsWithoutRef<"svg">) { - return ( - - - - Memento Dev - - - ); -} - export function Logo(props: React.ComponentPropsWithoutRef<"svg">) { return ( diff --git a/app/components/syntax/MobileNavigation.tsx b/app/components/syntax/MobileNavigation.tsx index e120858..dc8734d 100644 --- a/app/components/syntax/MobileNavigation.tsx +++ b/app/components/syntax/MobileNavigation.tsx @@ -1,4 +1,4 @@ -import { Suspense, useCallback, useEffect, useState } from "react"; +import React, { Suspense, useCallback, useEffect, useState } from "react"; import { usePageContext } from "vike-react/usePageContext"; import { Dialog, DialogPanel } from "@headlessui/react"; import { Navigation } from "@syntax/Navigation"; @@ -32,11 +32,12 @@ function CloseOnNavigation({ close }: { close: () => void }) { } export function MobileNavigation() { - let [isOpen, setIsOpen] = useState(false); - let close = useCallback(() => setIsOpen(false), [setIsOpen]); + const [isOpen, setIsOpen] = useState(false); + const close = useCallback(() => setIsOpen(false), [setIsOpen]); function onLinkClick(event: React.MouseEvent) { - let link = event.currentTarget; + const link = event.currentTarget; + if ( link.pathname + link.search + link.hash === window.location.pathname + window.location.search + window.location.hash diff --git a/app/components/syntax/Navigation.tsx b/app/components/syntax/Navigation.tsx index 1ae09f1..0793c25 100644 --- a/app/components/syntax/Navigation.tsx +++ b/app/components/syntax/Navigation.tsx @@ -1,8 +1,8 @@ import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/24/solid"; import { usePageContext } from "vike-react/usePageContext"; +import React, { useEffect, useState } from "react"; import { Link } from "@/components/common/Link"; import { navigation } from "@/lib/navigation"; -import { useEffect, useState } from "react"; import clsx from "clsx"; type NavigationItemProps = { diff --git a/app/components/syntax/PrevNextLinks.tsx b/app/components/syntax/PrevNextLinks.tsx index df886aa..5cabe56 100644 --- a/app/components/syntax/PrevNextLinks.tsx +++ b/app/components/syntax/PrevNextLinks.tsx @@ -1,6 +1,7 @@ import { usePageContext } from "vike-react/usePageContext"; import { Link } from "@/components/common/Link"; import { navigation } from "@/lib/navigation"; +import React from "react"; import clsx from "clsx"; function ArrowIcon(props: React.ComponentPropsWithoutRef<"svg">) { diff --git a/app/components/syntax/Prose.tsx b/app/components/syntax/Prose.tsx index 3a3e982..a071e13 100644 --- a/app/components/syntax/Prose.tsx +++ b/app/components/syntax/Prose.tsx @@ -8,7 +8,7 @@ export function Prose({ }: React.ComponentPropsWithoutRef & { as?: T; }) { - let Component = as ?? "div"; + const Component = as ?? "div"; return (