Skip to content

Commit

Permalink
[FE] FEAT: api 응답 수신전까지 토글 클릭 방지 #1680
Browse files Browse the repository at this point in the history
  • Loading branch information
jnkeniaem committed Nov 4, 2024
1 parent 37aa76c commit 38d6dda
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const AlarmCardContainer = ({ alarm }: { alarm: AlarmInfo | null }) => {
]
}
onToggleChange={handleToggleChange}
isLoading={isLoading}
/>
<ModalPortal>
{showResponseModal &&
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/Cabinet/components/Card/AlarmCard/AlarmCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ interface AlarmCardProps {
alarm: AlarmInfo;
buttons: IButtonProps[];
onToggleChange: (type: keyof AlarmInfo, checked: boolean) => void;
isLoading: boolean;
}

const AlarmCard = ({ alarm, buttons, onToggleChange }: AlarmCardProps) => {
const AlarmCard = ({
alarm,
buttons,
onToggleChange,
isLoading,
}: AlarmCardProps) => {
const handleToggle = (type: keyof AlarmInfo) => (checked: boolean) => {
onToggleChange(type, checked);
};
Expand All @@ -25,6 +31,7 @@ const AlarmCard = ({ alarm, buttons, onToggleChange }: AlarmCardProps) => {
id={`${type}-alarm`}
checked={alarm[type]}
onChange={handleToggle(type)}
disabled={isLoading}
/>
</CardContentStyled>
);
Expand Down

0 comments on commit 38d6dda

Please sign in to comment.