Skip to content

Commit

Permalink
edit: iconButton error 시 버튼 눌리게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jieunpark247 committed Jul 1, 2023
1 parent 7b40f10 commit c0d8af9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const IconButton = ({
const [iconSvgId, setIconSvgId] = useState<string>(iconType);

useEffect(() => {
if (!error) return;
setStatus(error ? ICON_STATUS.ERROR : disabled ? ICON_STATUS.DISABLE : ICON_STATUS.DEFAULT);
}, [error, disabled]);

Expand All @@ -55,8 +56,8 @@ const IconButton = ({
};

const handleOnClick = (e: MouseEvent<HTMLButtonElement>): void => {
if (error || disabled) return;
if (active) {
if (disabled) return;
if (active || error) {
setStatus(isActive ? ICON_STATUS.DEFAULT : ICON_STATUS.ACTIVE);
setIsActive(!isActive);
}
Expand Down

0 comments on commit c0d8af9

Please sign in to comment.