-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathShareDialog.tsx
More file actions
64 lines (57 loc) · 1.64 KB
/
ShareDialog.tsx
File metadata and controls
64 lines (57 loc) · 1.64 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
54
55
56
57
58
59
60
61
62
63
64
import {
Button,
Dialog,
Heading,
Separator,
Stack,
Text,
} from "@speakeasy-api/moonshine";
import { forwardRef, useImperativeHandle, useState } from "react";
import { CopyButton } from "./CopyButton";
export interface ShareDialogHandle {
setUrl: React.Dispatch<React.SetStateAction<string>>;
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
}
const ShareDialog = forwardRef<ShareDialogHandle, {}>((_, ref) => {
const [url, setUrl] = useState<string>("");
const [open, setOpen] = useState(false);
useImperativeHandle(ref, () => ({
setUrl,
setOpen,
}));
const handleClose = () => {
setOpen(false);
};
const handleOpenChange = (open: boolean) => {
setOpen(open);
};
return (
<Dialog open={open} onOpenChange={handleOpenChange}>
<Dialog.Content>
<Dialog.Header>
<Dialog.Title asChild>
<div>
<Heading variant="lg">Share</Heading>
<Text muted variant="sm" className="leading-none ">
Copy and paste the URL below anywhere to share this overlay
session with others.
</Text>
</div>
</Dialog.Title>
</Dialog.Header>
<Separator />
<Stack direction="vertical" gap={10} className="my-2">
<CopyButton className="w-full" value={url} />
</Stack>
<Separator />
<Dialog.Footer>
<Dialog.Close asChild>
<Button onClick={handleClose}>Done</Button>
</Dialog.Close>
</Dialog.Footer>
</Dialog.Content>
</Dialog>
);
});
ShareDialog.displayName = "ShareDialog";
export default ShareDialog;