mirror of
https://github.com/moghtech/komodo.git
synced 2026-04-30 14:25:22 -05:00
fix confirm button onclick behaviour
This commit is contained in:
@@ -167,9 +167,9 @@ export const ConfirmButton = ({
|
|||||||
}: {
|
}: {
|
||||||
title: string;
|
title: string;
|
||||||
icon: ReactNode;
|
icon: ReactNode;
|
||||||
|
onClick: () => void;
|
||||||
intent?: ButtonProps["intent"];
|
intent?: ButtonProps["intent"];
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onClick?: () => void;
|
|
||||||
}) => {
|
}) => {
|
||||||
const [confirmed, set] = useState(false);
|
const [confirmed, set] = useState(false);
|
||||||
|
|
||||||
@@ -180,7 +180,14 @@ export const ConfirmButton = ({
|
|||||||
icon={confirmed ? <Check className="w-4 h-4" /> : icon}
|
icon={confirmed ? <Check className="w-4 h-4" /> : icon}
|
||||||
intent={intent}
|
intent={intent}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={confirmed ? onClick : () => set(true)}
|
onClick={
|
||||||
|
confirmed
|
||||||
|
? () => {
|
||||||
|
onClick();
|
||||||
|
set(false);
|
||||||
|
}
|
||||||
|
: () => set(true)
|
||||||
|
}
|
||||||
className={confirmed ? "z-50" : ""}
|
className={confirmed ? "z-50" : ""}
|
||||||
/>
|
/>
|
||||||
{confirmed && (
|
{confirmed && (
|
||||||
|
|||||||
Reference in New Issue
Block a user