Skip to content

Commit

Permalink
refactor: Badge 컴포넌트 children을 ReactNode 타입으로 확장
Browse files Browse the repository at this point in the history
  • Loading branch information
semnil5202 committed Mar 15, 2024
1 parent 928be5b commit a9ae51e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { ComponentPropsWithoutRef, ElementType } from 'react';
import { ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';

import { ColorType } from '../../styles/theme';

Expand All @@ -10,7 +10,7 @@ type Props<T extends ElementType> = {
as?: T;
backgroundColor?: BackgroundColorType;
fontColor?: FontColorType;
children: number | string;
children: ReactNode;
} & ComponentPropsWithoutRef<T>;

const Badge = <T extends ElementType>({
Expand Down
4 changes: 2 additions & 2 deletions src/stories/Badge.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meta, StoryObj } from '@storybook/react';

import Badge from '../components/Badge/Badge';
import { useEffect, useRef, useState } from 'react';
import { ReactNode, useEffect, useRef, useState } from 'react';

const meta = {
title: 'Components/Badge',
Expand Down Expand Up @@ -55,7 +55,7 @@ export const Sample: Story = {
},
render: ({ children, backgroundColor, fontColor }) => {
const timerId = useRef<NodeJS.Timeout | null>(null);
const [badges, setBadges] = useState<string[]>([
const [badges, setBadges] = useState<ReactNode[]>([
'서비스기획',
'영상디자인',
'시각디자인',
Expand Down

0 comments on commit a9ae51e

Please sign in to comment.