From 339b56bad203c977a87dfa1bd1801010f677a487 Mon Sep 17 00:00:00 2001 From: Bochkovskyi Date: Fri, 9 Feb 2024 00:28:43 +0200 Subject: [PATCH 1/2] update components props --- src/components/header/header-navbar.tsx | 9 ++++----- src/components/header/header.tsx | 9 ++++----- .../header/menu/menu-icon/menu-icon-bar.tsx | 7 ++++--- .../header/menu/menu-icon/menu-icon.tsx | 9 ++++----- src/components/header/menu/menu-item.tsx | 15 +++++++++------ src/components/header/menu/menu.tsx | 14 +++++++++----- src/components/sections/projects/project-card.tsx | 3 ++- src/components/ui/button.tsx | 2 +- src/components/ui/content.tsx | 11 +++++++---- src/components/ui/heading.tsx | 2 ++ src/components/ui/socials/socials-item.tsx | 8 ++++---- src/components/ui/socials/socials.tsx | 8 ++++---- src/components/ui/theme-toggler.tsx | 15 ++++++++++----- 13 files changed, 64 insertions(+), 48 deletions(-) diff --git a/src/components/header/header-navbar.tsx b/src/components/header/header-navbar.tsx index 92bd24f..4837c46 100644 --- a/src/components/header/header-navbar.tsx +++ b/src/components/header/header-navbar.tsx @@ -6,13 +6,11 @@ import Socials from '@/components/ui/socials/socials' import useMediaQuery from '@/hooks/use-media-query' import HeaderContext from '@/store/header-context' import { MOBILE_BREAKPOINT, cn } from '@/utils' -import { FC, useContext } from 'react' +import { FC, HTMLAttributes, useContext } from 'react' -type HeaderNavbarProps = { - className?: string -} +interface HeaderNavbarProps extends HTMLAttributes {} -const HeaderNavbar: FC = ({ className }) => { +const HeaderNavbar: FC = ({ className, ...props }) => { const { isMenuOpened } = useContext(HeaderContext) const isMobile = useMediaQuery(MOBILE_BREAKPOINT) @@ -23,6 +21,7 @@ const HeaderNavbar: FC = ({ className }) => { isMenuOpened && 'translate-y-0', className )} + {...props} > {} -const Header: FC = ({ className }) => { +const Header: FC = ({ className, ...props }) => { return (
diff --git a/src/components/header/menu/menu-icon/menu-icon-bar.tsx b/src/components/header/menu/menu-icon/menu-icon-bar.tsx index 3964263..61f61b3 100644 --- a/src/components/header/menu/menu-icon/menu-icon-bar.tsx +++ b/src/components/header/menu/menu-icon/menu-icon-bar.tsx @@ -1,15 +1,16 @@ import { cn } from '@/utils' -import { FC } from 'react' +import { FC, HTMLAttributes } from 'react' -type MenuIconBarProps = { className?: string } +interface MenuIconBarProps extends HTMLAttributes {} -const MenuIconBar: FC = ({ className }) => { +const MenuIconBar: FC = ({ className, ...props }) => { return ( ) } diff --git a/src/components/header/menu/menu-icon/menu-icon.tsx b/src/components/header/menu/menu-icon/menu-icon.tsx index 4d8bfae..6f3cf55 100644 --- a/src/components/header/menu/menu-icon/menu-icon.tsx +++ b/src/components/header/menu/menu-icon/menu-icon.tsx @@ -2,21 +2,20 @@ import HeaderContext from '@/store/header-context' import { cn } from '@/utils' -import { FC, useContext } from 'react' +import { FC, HTMLAttributes, useContext } from 'react' import MenuIconBar from './menu-icon-bar' -type MenuIconProps = { - className?: string -} +interface MenuIconProps extends HTMLAttributes {} -const MenuIcon: FC = ({ className }) => { +const MenuIcon: FC = ({ className, ...props }) => { const { isMenuOpened, toggleMenu } = useContext(HeaderContext) return (
{ href: string } -const MenuItem: FC = ({ children, className, href }) => { +const MenuItem: FC = ({ + children, + className, + href, + ...props +}) => { const { toggleMenu } = useContext(HeaderContext) return ( -
  • +
  • { orientation?: 'horizontal' | 'vertical' } -const Menu: FC = ({ children, className, orientation }) => { +const Menu: FC = ({ + children, + className, + orientation, + ...props +}) => { return (
      = ({ children, className, orientation }) => { orientation === 'vertical' ? 'flex-col gap-6' : 'flex-row gap-10', className )} + {...props} > {children}
    diff --git a/src/components/sections/projects/project-card.tsx b/src/components/sections/projects/project-card.tsx index 6638517..e9c3441 100644 --- a/src/components/sections/projects/project-card.tsx +++ b/src/components/sections/projects/project-card.tsx @@ -18,9 +18,10 @@ const ProjectCard: FC = ({ className, data: { body, image, slug, technologies, title }, imageSizes, + ...props }) => { return ( -
    +
    {image ? ( diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 7e8f18a..6d601cc 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -25,7 +25,7 @@ export const buttonVariants = cva( } ) -interface ButtonProps +export interface ButtonProps extends ButtonHTMLAttributes, VariantProps {} diff --git a/src/components/ui/content.tsx b/src/components/ui/content.tsx index dbd298a..5bd0325 100644 --- a/src/components/ui/content.tsx +++ b/src/components/ui/content.tsx @@ -1,11 +1,14 @@ import { cn } from '@/utils' -import { FC, ReactNode } from 'react' +import { FC, HTMLAttributes } from 'react' -type ContentProps = { children: ReactNode; className?: string } +interface ContentProps extends HTMLAttributes {} -const Content: FC = ({ children, className }) => { +const Content: FC = ({ children, className, ...props }) => { return ( -
    +
    {children}
    ) diff --git a/src/components/ui/heading.tsx b/src/components/ui/heading.tsx index c324e84..8286ec0 100644 --- a/src/components/ui/heading.tsx +++ b/src/components/ui/heading.tsx @@ -37,12 +37,14 @@ const Heading: FC = ({ position, size, variant, + ...props }) => { const HeadingTag = size ? size : 'h1' return ( {children} diff --git a/src/components/ui/socials/socials-item.tsx b/src/components/ui/socials/socials-item.tsx index 39adab4..9c1999d 100644 --- a/src/components/ui/socials/socials-item.tsx +++ b/src/components/ui/socials/socials-item.tsx @@ -1,10 +1,9 @@ import Link from 'next/link' -import { ComponentType, FC } from 'react' +import { ComponentType, FC, LiHTMLAttributes } from 'react' import { IconBaseProps } from 'react-icons' -type SocialsItemProps = { +interface SocialsItemProps extends LiHTMLAttributes { Icon: ComponentType - className?: string href: string title: string } @@ -14,9 +13,10 @@ const SocialsItem: FC = ({ className, href, title, + ...props }) => { return ( -
  • +
  • { orientation?: 'horizontal' | 'vertical' } -const Socials: FC = ({ className, orientation }) => { +const Socials: FC = ({ className, orientation, ...props }) => { return (
      = ({ className, orientation }) => { orientation === 'vertical' ? 'flex-col' : 'flex-row', className )} + {...props} > = ({ className }) => { +const ThemeToggler: FC = ({ className, ...props }) => { const [mounted, setMounted] = useState(false) const { resolvedTheme, setTheme } = useTheme() const isDarkTheme = (resolvedTheme as Theme) === 'dark' @@ -20,11 +20,16 @@ const ThemeToggler: FC = ({ className }) => { return ( <> {!mounted ? ( - ) : ( -