Skip to content

Commit

Permalink
refactor: children 강제성 제외를 위해 React.FC 타입 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
dahyeo-n committed Dec 22, 2024
1 parent 0ea5c0b commit f18e373
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 33 deletions.
6 changes: 2 additions & 4 deletions src/components/Button/CategoryButton.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { CategoryButtonProps } from '@/types';

import { FC } from 'react';

const CategoryButton: FC<CategoryButtonProps> = ({
const CategoryButton = ({
backgroundColor = 'bg-gray-800',
textColor = 'text-gray-300',
textSize,
children,

onClick,
ariaLabel,
}) => {
}: CategoryButtonProps) => {
return (
<button
onClick={onClick}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Button/FollowButton.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use client';

import { FC, useState } from 'react';
import { useState } from 'react';

import { FollowButtonProps } from '@/types/buttons/FollowButtonProps';

import Icon from '../Icon/Icon';

const FollowButton: FC<FollowButtonProps> = ({
const FollowButton = ({
backgroundColor = 'bg-gray-900',
textColor = 'text-white',
textSize = 'button-s',

onClick,
ariaLabel,
}) => {
}: FollowButtonProps) => {
const [isFollowing, setIsFollowing] = useState(false);

const toggleFollow = () => {
Expand Down
6 changes: 2 additions & 4 deletions src/components/Button/SquareButtonL.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { SquareButtonLProps } from '@/types';

import { FC } from 'react';

const SquareButtonL: FC<SquareButtonLProps> = ({
const SquareButtonL = ({
backgroundColor = 'bg-gray-800',
textColor = 'text-white',
textSize,
Expand All @@ -15,7 +13,7 @@ const SquareButtonL: FC<SquareButtonLProps> = ({
icon,
iconPosition,
type = 'button',
}) => {
}: SquareButtonLProps) => {
return (
<button
type={type}
Expand Down
6 changes: 3 additions & 3 deletions src/components/FilterDropdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { FC, useEffect, useRef, useState } from 'react';
import { useEffect, useRef, useState } from 'react';

import Icon from '../Icon/Icon';

Expand All @@ -10,11 +10,11 @@ interface FilterDropdownProps {
onChange: (value: string) => void;
}

const FilterDropdown: FC<FilterDropdownProps> = ({
const FilterDropdown = ({
options,
selected,
onChange,
}) => {
}: FilterDropdownProps) => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const dropdownRef = useRef<HTMLDivElement>(null);

Expand Down
9 changes: 2 additions & 7 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentType, FC } from 'react';
import { ComponentType } from 'react';

import iconSizes, { IconSize } from './iconSizes';
import { iconsNames } from './iconsNames';
Expand All @@ -10,12 +10,7 @@ interface IconProps {
onClick?: () => void;
}

const Icon: FC<IconProps> = ({
name,
size = 'm',
className = '',
onClick,
}: IconProps) => {
const Icon = ({ name, size = 'm', className = '', onClick }: IconProps) => {
const Component = iconsNames[name] as ComponentType<{
className?: string;
onClick?: () => void;
Expand Down
9 changes: 6 additions & 3 deletions src/components/Icon/icons/Close.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { FC } from 'react';
import { ReactNode } from 'react';

const Close: FC<{ className?: string; onClick?: () => void }> = ({
const Close = ({
className,
onClick,
}) => {
}: {
className?: string;
onClick?: () => void;
}): ReactNode => {
return (
<svg
className={className}
Expand Down
7 changes: 4 additions & 3 deletions src/components/Icon/icons/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { FC } from 'react';

const Menu: FC<{ className?: string; onClick?: () => void }> = ({
const Menu = ({
className,
onClick,
}: {
className?: string;
onClick?: () => void;
}) => {
return (
<svg
Expand Down
10 changes: 8 additions & 2 deletions src/components/Icon/iconsNames.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from 'react';
import { ReactNode } from 'react';

import AlertCircle from './icons/AlertCircle';
import AlternateShare from './icons/AlternateShare';
Expand Down Expand Up @@ -39,7 +39,13 @@ import UploadShare from './icons/UploadShare';

export const iconsNames: Record<
string,
FC<{ className?: string; onClick?: () => void }>
({
className,
onClick,
}: {
className?: string;
onClick?: () => void;
}) => ReactNode
> = {
AlertCircle,
AlternateShare,
Expand Down
6 changes: 2 additions & 4 deletions src/components/Pagination/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { FC } from 'react';

import Icon from '../Icon/Icon';

interface PaginationProps {
Expand All @@ -8,11 +6,11 @@ interface PaginationProps {
onPageChange: (page: number) => void;
}

const Pagination: FC<PaginationProps> = ({
const Pagination = ({
currentPage,
totalPages,
onPageChange,
}) => {
}: PaginationProps) => {
const isFirstPage = currentPage === 1;
const isLastPage = currentPage === totalPages;

Expand Down

0 comments on commit f18e373

Please sign in to comment.