Skip to content

Commit 3ad2d53

Browse files
committed
refactor: remove AlertDialog from playground
1 parent 433f311 commit 3ad2d53

File tree

3 files changed

+43
-37
lines changed

3 files changed

+43
-37
lines changed
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AlertDialog, Button } from '@douglasneuroinformatics/libui/components';
1+
import { Button, Dialog } from '@douglasneuroinformatics/libui/components';
22

33
import { useAppStore } from '@/store';
44

@@ -11,13 +11,13 @@ export type DeleteFileDialogProps = {
1111
export const DeleteFileDialog = ({ filename, isOpen, setIsOpen }: DeleteFileDialogProps) => {
1212
const deleteFile = useAppStore((store) => store.deleteFile);
1313
return filename ? (
14-
<AlertDialog open={isOpen} onOpenChange={setIsOpen}>
15-
<AlertDialog.Content>
16-
<AlertDialog.Header>
17-
<AlertDialog.Title>{`Are you sure you want to delete "${filename}"?`}</AlertDialog.Title>
18-
<AlertDialog.Description>Once deleted, this file cannot be restored</AlertDialog.Description>
19-
</AlertDialog.Header>
20-
<AlertDialog.Footer>
14+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
15+
<Dialog.Content>
16+
<Dialog.Header>
17+
<Dialog.Title>{`Are you sure you want to delete "${filename}"?`}</Dialog.Title>
18+
<Dialog.Description>Once deleted, this file cannot be restored</Dialog.Description>
19+
</Dialog.Header>
20+
<Dialog.Footer>
2121
<Button
2222
variant="danger"
2323
onClick={() => {
@@ -27,9 +27,11 @@ export const DeleteFileDialog = ({ filename, isOpen, setIsOpen }: DeleteFileDial
2727
>
2828
Delete
2929
</Button>
30-
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
31-
</AlertDialog.Footer>
32-
</AlertDialog.Content>
33-
</AlertDialog>
30+
<Button type="button" variant="outline" onClick={() => setIsOpen(false)}>
31+
Cancel
32+
</Button>
33+
</Dialog.Footer>
34+
</Dialog.Content>
35+
</Dialog>
3436
) : null;
3537
};
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AlertDialog, Button } from '@douglasneuroinformatics/libui/components';
1+
import { Button, Dialog } from '@douglasneuroinformatics/libui/components';
22
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks';
33

44
import { useAppStore } from '@/store';
@@ -14,13 +14,13 @@ export const DeleteInstrumentDialog = ({ isOpen, setIsOpen }: DeleteInstrumentDi
1414
const selectedInstrument = useAppStore((store) => store.selectedInstrument);
1515

1616
return (
17-
<AlertDialog open={isOpen} onOpenChange={setIsOpen}>
18-
<AlertDialog.Content>
19-
<AlertDialog.Header>
20-
<AlertDialog.Title>Are you absolutely sure?</AlertDialog.Title>
21-
<AlertDialog.Description>This instrument will be deleted from local storage.</AlertDialog.Description>
22-
</AlertDialog.Header>
23-
<AlertDialog.Footer>
17+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
18+
<Dialog.Content>
19+
<Dialog.Header>
20+
<Dialog.Title>Are you absolutely sure?</Dialog.Title>
21+
<Dialog.Description>This instrument will be deleted from local storage.</Dialog.Description>
22+
</Dialog.Header>
23+
<Dialog.Footer>
2424
<Button
2525
variant="danger"
2626
onClick={() => {
@@ -31,9 +31,11 @@ export const DeleteInstrumentDialog = ({ isOpen, setIsOpen }: DeleteInstrumentDi
3131
>
3232
Delete
3333
</Button>
34-
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
35-
</AlertDialog.Footer>
36-
</AlertDialog.Content>
37-
</AlertDialog>
34+
<Button type="button" variant="outline" onClick={() => setIsOpen(false)}>
35+
Cancel
36+
</Button>
37+
</Dialog.Footer>
38+
</Dialog.Content>
39+
</Dialog>
3840
);
3941
};
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AlertDialog, Button } from '@douglasneuroinformatics/libui/components';
1+
import { Button, Dialog } from '@douglasneuroinformatics/libui/components';
22
import { useNotificationsStore } from '@douglasneuroinformatics/libui/hooks';
33

44
import { useAppStore } from '@/store';
@@ -14,16 +14,16 @@ export const RestoreDefaultsDialog = ({ isOpen, setIsOpen }: RestoreDefaultsDial
1414
const resetSettings = useAppStore((store) => store.resetSettings);
1515

1616
return (
17-
<AlertDialog open={isOpen} onOpenChange={setIsOpen}>
18-
<AlertDialog.Content>
19-
<AlertDialog.Header>
20-
<AlertDialog.Title>Are you absolutely sure?</AlertDialog.Title>
21-
<AlertDialog.Description>
17+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
18+
<Dialog.Content>
19+
<Dialog.Header>
20+
<Dialog.Title>Are you absolutely sure?</Dialog.Title>
21+
<Dialog.Description>
2222
This action will <span className="font-bold uppercase">delete all user-defined instruments</span> in local
2323
storage and restore the default configuration.
24-
</AlertDialog.Description>
25-
</AlertDialog.Header>
26-
<AlertDialog.Footer>
24+
</Dialog.Description>
25+
</Dialog.Header>
26+
<Dialog.Footer>
2727
<Button
2828
variant="danger"
2929
onClick={() => {
@@ -35,9 +35,11 @@ export const RestoreDefaultsDialog = ({ isOpen, setIsOpen }: RestoreDefaultsDial
3535
>
3636
Reset
3737
</Button>
38-
<AlertDialog.Cancel>Cancel</AlertDialog.Cancel>
39-
</AlertDialog.Footer>
40-
</AlertDialog.Content>
41-
</AlertDialog>
38+
<Button type="button" variant="outline" onClick={() => setIsOpen(false)}>
39+
Cancel
40+
</Button>
41+
</Dialog.Footer>
42+
</Dialog.Content>
43+
</Dialog>
4244
);
4345
};

0 commit comments

Comments
 (0)