Skip to content

Commit

Permalink
fix: size, variant 옵셔널로 넣을 수 있도록 변환
Browse files Browse the repository at this point in the history
  • Loading branch information
ocahs9 committed Jul 9, 2024
1 parent 76c6afe commit fbe1381
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/components/commons/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ export type ButtonVariantTypes = "primary" | "line" | "gray" | "blue";

//React.ButtonHTMLAttributes는 버튼 속성에 집중하긴 했지만, 제네릭 타입이다.
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
size: ButtonSizeTypes;
variant: ButtonVariantTypes;
size?: ButtonSizeTypes;
variant?: ButtonVariantTypes;
children: ReactNode; //자식 노드(텍스트)를 받기 위해 필수.
onClick?: React.MouseEventHandler<HTMLButtonElement>; //MouseEvent와는 상이
}

//disabled는 버튼의 기본 속성(따라서 위의 interface에서 명시되어 있지는 않다.)
const Button = ({ onClick, size, disabled, variant, children }: ButtonProps) => {
const Button = ({
onClick,
size = "xlarge",
disabled,
variant = "primary",
children,
}: ButtonProps) => {
return (
<S.DefaultBtn
onClick={onClick}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/MyRegisterdShow/MyRegisterdShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const MyRegisterdShow = () => {
navigate("/");
};

const [isNothing, setIsNothing] = useState<boolean>(false);
const [isNothing, setIsNothing] = useState(false);

return (
<>
Expand Down

0 comments on commit fbe1381

Please sign in to comment.