-
Notifications
You must be signed in to change notification settings - Fork 190
Expand file tree
/
Copy pathDialogComponent.tsx
More file actions
53 lines (49 loc) · 1.33 KB
/
DialogComponent.tsx
File metadata and controls
53 lines (49 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import * as React from "react";
import {
Dialog,
DialogSurface,
DialogTitle,
DialogBody,
DialogContent,
DialogActions,
Button,
useId,
} from "@fluentui/react-components";
import { ConfirmationProps } from './DialogComponentTypes'
export const Confirmation: React.FC<ConfirmationProps> = ({
title,
content,
isDialogOpen,
onDialogClose,
footerButtons,
}) => {
const dialogId = useId("dialog-");
return (
<Dialog open={isDialogOpen} onOpenChange={onDialogClose}>
<DialogSurface
aria-labelledby={`${dialogId}-title`}
aria-describedby={`${dialogId}-content`}
>
<DialogBody>
<DialogTitle id={`${dialogId}-title`}>{title}</DialogTitle>
<DialogContent id={`${dialogId}-content`}>{content}</DialogContent>
<DialogActions>
{/* Render the footer buttons dynamically */}
{footerButtons.map((button, index) => (
<Button
key={index}
appearance={button.appearance}
onClick={() => {
button.onClick();
onDialogClose(); // Close the dialog after an action
}}
>
{button.text}
</Button>
))}
</DialogActions>
</DialogBody>
</DialogSurface>
</Dialog>
);
};