From d082326e16264a49c3f41ad46e356e586ce2cbd9 Mon Sep 17 00:00:00 2001 From: Dahyeon Jin Date: Fri, 20 Dec 2024 00:11:38 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20React=EC=97=90=EC=84=9C=20=EC=A0=9C?= =?UTF-8?q?=EA=B3=B5=ED=95=98=EB=8A=94=20=ED=83=80=EC=9E=85=20import=20?= =?UTF-8?q?=EC=8B=9C,=20=EA=B5=AC=EC=A1=B0=20=EB=B6=84=ED=95=B4=20?= =?UTF-8?q?=ED=95=A0=EB=8B=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/layout.tsx | 4 ++-- src/components/Button/CategoryButton.tsx | 4 ++-- src/components/Button/FollowButton.tsx | 4 ++-- src/components/Button/SquareButtonL.tsx | 4 ++-- src/components/Icon/Icon.tsx | 6 +++--- src/components/Icon/icons/Close.tsx | 4 ++-- src/components/Icon/icons/Menu.tsx | 4 ++-- src/components/Icon/iconsNames.ts | 4 ++-- src/components/Layout/AppShell.tsx | 4 ++-- src/types/buttons/BaseButtonProps.ts | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 776de02..3fda89a 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,6 +1,6 @@ import type { Metadata } from 'next'; import localFont from 'next/font/local'; -import React from 'react'; +import { ReactNode } from 'react'; import '../styles/globals.css'; @@ -24,7 +24,7 @@ export const metadata: Metadata = { export default function RootLayout({ children, }: Readonly<{ - children: React.ReactNode; + children: ReactNode; }>) { return ( diff --git a/src/components/Button/CategoryButton.tsx b/src/components/Button/CategoryButton.tsx index 5aa6807..e3a14fb 100644 --- a/src/components/Button/CategoryButton.tsx +++ b/src/components/Button/CategoryButton.tsx @@ -1,8 +1,8 @@ import { CategoryButtonProps } from '@/types'; -import React from 'react'; +import { FC } from 'react'; -const CategoryButton: React.FC = ({ +const CategoryButton: FC = ({ backgroundColor = 'bg-gray-800', textColor = 'text-gray-300', textSize, diff --git a/src/components/Button/FollowButton.tsx b/src/components/Button/FollowButton.tsx index a762bd3..c93511a 100644 --- a/src/components/Button/FollowButton.tsx +++ b/src/components/Button/FollowButton.tsx @@ -1,12 +1,12 @@ 'use client'; -import React, { useState } from 'react'; +import { FC, useState } from 'react'; import { FollowButtonProps } from '@/types/buttons/FollowButtonProps'; import Icon from '../Icon/Icon'; -const FollowButton: React.FC = ({ +const FollowButton: FC = ({ backgroundColor = 'bg-gray-900', textColor = 'text-white', textSize = 'button-s', diff --git a/src/components/Button/SquareButtonL.tsx b/src/components/Button/SquareButtonL.tsx index 6f102ea..486d544 100644 --- a/src/components/Button/SquareButtonL.tsx +++ b/src/components/Button/SquareButtonL.tsx @@ -1,8 +1,8 @@ import { SquareButtonLProps } from '@/types'; -import React from 'react'; +import { FC } from 'react'; -const SquareButtonL: React.FC = ({ +const SquareButtonL: FC = ({ backgroundColor = 'bg-gray-800', textColor = 'text-white', textSize, diff --git a/src/components/Icon/Icon.tsx b/src/components/Icon/Icon.tsx index 5b6bb32..af4907b 100644 --- a/src/components/Icon/Icon.tsx +++ b/src/components/Icon/Icon.tsx @@ -1,17 +1,17 @@ -import React from 'react'; +import { ComponentType, FC } from 'react'; import { IconProps } from '@/types'; import iconSizes from './iconSizes'; import { iconsNames } from './iconsNames'; -const Icon: React.FC = ({ +const Icon: FC = ({ name, size = 'm', className = '', onClick, }: IconProps) => { - const Component = iconsNames[name] as React.ComponentType<{ + const Component = iconsNames[name] as ComponentType<{ className?: string; onClick?: () => void; }>; diff --git a/src/components/Icon/icons/Close.tsx b/src/components/Icon/icons/Close.tsx index 2736050..c5f8408 100644 --- a/src/components/Icon/icons/Close.tsx +++ b/src/components/Icon/icons/Close.tsx @@ -1,6 +1,6 @@ -import React from 'react'; +import { FC } from 'react'; -const Close: React.FC<{ className?: string; onClick?: () => void }> = ({ +const Close: FC<{ className?: string; onClick?: () => void }> = ({ className, onClick, }) => { diff --git a/src/components/Icon/icons/Menu.tsx b/src/components/Icon/icons/Menu.tsx index 613bcee..a3e3033 100644 --- a/src/components/Icon/icons/Menu.tsx +++ b/src/components/Icon/icons/Menu.tsx @@ -1,6 +1,6 @@ -import React from 'react'; +import { FC } from 'react'; -const Menu: React.FC<{ className?: string; onClick?: () => void }> = ({ +const Menu: FC<{ className?: string; onClick?: () => void }> = ({ className, onClick, }) => { diff --git a/src/components/Icon/iconsNames.ts b/src/components/Icon/iconsNames.ts index 53adef8..e7635e5 100644 --- a/src/components/Icon/iconsNames.ts +++ b/src/components/Icon/iconsNames.ts @@ -1,4 +1,4 @@ -import React from 'react'; +import { FC } from 'react'; import AlertCircle from './icons/AlertCircle'; import AlternateShare from './icons/AlternateShare'; @@ -39,7 +39,7 @@ import UploadShare from './icons/UploadShare'; export const iconsNames: Record< string, - React.FC<{ className?: string; onClick?: () => void }> + FC<{ className?: string; onClick?: () => void }> > = { AlertCircle, AlternateShare, diff --git a/src/components/Layout/AppShell.tsx b/src/components/Layout/AppShell.tsx index 886157f..958fb46 100644 --- a/src/components/Layout/AppShell.tsx +++ b/src/components/Layout/AppShell.tsx @@ -6,9 +6,9 @@ import Navbar from '@/components/Navbar'; import { NextUIProvider } from '@nextui-org/react'; import { ThemeProvider as NextThemesProvider } from 'next-themes'; -import React from 'react'; +import { ReactNode } from 'react'; -const AppShell = ({ children }: { children: React.ReactNode }) => { +const AppShell = ({ children }: { children: ReactNode }) => { return ( <> diff --git a/src/types/buttons/BaseButtonProps.ts b/src/types/buttons/BaseButtonProps.ts index cbec5a7..3c97f17 100644 --- a/src/types/buttons/BaseButtonProps.ts +++ b/src/types/buttons/BaseButtonProps.ts @@ -1,17 +1,17 @@ -import React from 'react'; +import { ReactNode } from 'react'; export interface BaseButtonProps { backgroundColor: string; textColor: string; textSize: string; - children: React.ReactNode; + children: ReactNode; onClick?: () => void; ariaLabel?: string; disabled?: boolean; loading?: boolean; - icon?: React.ReactNode; + icon?: ReactNode; iconPosition?: 'left' | 'right'; type?: 'button' | 'submit' | 'reset';