Skip to content

Commit

Permalink
refactor: React에서 제공하는 타입 import 시, 구조 분해 할당
Browse files Browse the repository at this point in the history
  • Loading branch information
dahyeo-n committed Dec 19, 2024
1 parent b6769d8 commit d082326
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -24,7 +24,7 @@ export const metadata: Metadata = {
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
children: ReactNode;
}>) {
return (
<html lang='ko'>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Button/CategoryButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CategoryButtonProps } from '@/types';

import React from 'react';
import { FC } from 'react';

const CategoryButton: React.FC<CategoryButtonProps> = ({
const CategoryButton: FC<CategoryButtonProps> = ({
backgroundColor = 'bg-gray-800',
textColor = 'text-gray-300',
textSize,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Button/FollowButton.tsx
Original file line number Diff line number Diff line change
@@ -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<FollowButtonProps> = ({
const FollowButton: FC<FollowButtonProps> = ({
backgroundColor = 'bg-gray-900',
textColor = 'text-white',
textSize = 'button-s',
Expand Down
4 changes: 2 additions & 2 deletions src/components/Button/SquareButtonL.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SquareButtonLProps } from '@/types';

import React from 'react';
import { FC } from 'react';

const SquareButtonL: React.FC<SquareButtonLProps> = ({
const SquareButtonL: FC<SquareButtonLProps> = ({
backgroundColor = 'bg-gray-800',
textColor = 'text-white',
textSize,
Expand Down
6 changes: 3 additions & 3 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -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<IconProps> = ({
const Icon: FC<IconProps> = ({
name,
size = 'm',
className = '',
onClick,
}: IconProps) => {
const Component = iconsNames[name] as React.ComponentType<{
const Component = iconsNames[name] as ComponentType<{
className?: string;
onClick?: () => void;
}>;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Icon/icons/Close.tsx
Original file line number Diff line number Diff line change
@@ -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,
}) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Icon/icons/Menu.tsx
Original file line number Diff line number Diff line change
@@ -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,
}) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Icon/iconsNames.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import { FC } from 'react';

import AlertCircle from './icons/AlertCircle';
import AlternateShare from './icons/AlternateShare';
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Layout/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<NextUIProvider>
Expand Down
6 changes: 3 additions & 3 deletions src/types/buttons/BaseButtonProps.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit d082326

Please sign in to comment.