From 548541545d4aa0524a3e1f505c2a2f619dd7c57e Mon Sep 17 00:00:00 2001 From: Zhenya Goroh Date: Tue, 8 Oct 2024 21:28:50 +0300 Subject: [PATCH] Refactored navigation component --- src/components/navigation.tsx | 127 ++++++++++++++++++---------------- 1 file changed, 66 insertions(+), 61 deletions(-) diff --git a/src/components/navigation.tsx b/src/components/navigation.tsx index 236f147..771bdeb 100644 --- a/src/components/navigation.tsx +++ b/src/components/navigation.tsx @@ -62,6 +62,58 @@ export const components: { }, ]; +const ListItem = React.forwardRef< + React.ElementRef<"a">, + React.ComponentPropsWithoutRef<"a"> +>(({ className, title, children, ...props }, ref) => { + return ( +
  • + + +
    {title}
    +

    + {children} +

    +
    +
    +
  • + ); +}); +const ListItem2 = React.forwardRef< + React.ElementRef<"a">, + React.ComponentPropsWithoutRef<"a"> +>(({ className, title, children, ...props }, ref) => { + return ( +
  • + + +
    {title}
    +

    + {children} +

    +
    +
    +
  • + ); +}); +ListItem.displayName = "ListItem"; +ListItem.displayName = "ListItem2"; + export function Navigation() { return (
    @@ -116,6 +168,7 @@ export function Navigation() { Support us on Patreon and get exclusive rewards and keep the project alive. @@ -123,6 +176,7 @@ export function Navigation() { Ko-fi is a way to support us with a one-time donation and help us keep the project alive. @@ -134,15 +188,18 @@ export function Navigation() { {"Useful Links"}
      - {components.map((component) => ( - - {component.description} - - ))} + {components.map( + ({ description, href, title, isTargetBlank }) => ( + + {description} + + ), + )}
    @@ -152,55 +209,3 @@ export function Navigation() {
    ); } - -const ListItem = React.forwardRef< - React.ElementRef<"a">, - React.ComponentPropsWithoutRef<"a"> ->(({ className, title, children, ...props }, ref) => { - return ( -
  • - - -
    {title}
    -

    - {children} -

    -
    -
    -
  • - ); -}); -const ListItem2 = React.forwardRef< - React.ElementRef<"a">, - React.ComponentPropsWithoutRef<"a"> ->(({ className, title, children, ...props }, ref) => { - return ( -
  • - - -
    {title}
    -

    - {children} -

    -
    -
    -
  • - ); -}); -ListItem.displayName = "ListItem"; -ListItem.displayName = "ListItem2";