Skip to content

Commit

Permalink
refactor: TypeIconComponent 네이밍 변경 및 공통 prop 빼기
Browse files Browse the repository at this point in the history
  • Loading branch information
hamo-o committed Sep 22, 2024
1 parent eaeec49 commit 286e932
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions packages/wow-ui/src/components/Toast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { FlexProps } from "@styled-system/jsx";
import { Flex, styled } from "@styled-system/jsx";
import type { CSSProperties, ReactNode } from "react";
import { forwardRef, useEffect, useState } from "react";
import type { IconProps } from "wowds-icons";
import { Close, RightArrow } from "wowds-icons";

import useToast from "./useToast";
Expand Down Expand Up @@ -49,24 +50,11 @@ const Toast = forwardRef(
const ANIMATION_DURATION = 200;
const { removeToast } = useToast();

const TypeIconComponent = () => {
const IconComponentByType = (props: IconProps) => {
if (type === "close")
return (
<Close
stroke="outline"
style={{ cursor: "pointer" }}
width={14}
onClick={() => removeToast(id)}
/>
);
return <Close width={14} onClick={() => removeToast(id)} {...props} />;
else if (type === "arrow")
return (
<RightArrow
stroke="outline"
style={{ cursor: "pointer" }}
onClick={onClickArrowIcon}
/>
);
return <RightArrow onClick={onClickArrowIcon} {...props} />;
return null;
};

Expand Down Expand Up @@ -116,7 +104,7 @@ const Toast = forwardRef(
)}
</Flex>
</Flex>
<TypeIconComponent />
<IconComponentByType stroke="outline" style={{ cursor: "pointer" }} />
</Flex>
);
}
Expand Down

0 comments on commit 286e932

Please sign in to comment.