Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/course/common/run-all-popover.tsx
10799 views
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Button, Popover } from "antd";
7
import type { ReactNode } from "react";
8
9
import { Icon } from "@cocalc/frontend/components";
10
11
interface RunAllPopoverProps {
12
id: string;
13
open: boolean;
14
onOpenChange: (next: boolean) => void;
15
type: "primary" | "default";
16
content: ReactNode | (() => ReactNode);
17
ariaLabel: string;
18
}
19
20
export function RunAllPopover({
21
id,
22
open,
23
onOpenChange,
24
type,
25
content,
26
ariaLabel,
27
}: RunAllPopoverProps) {
28
return (
29
<Popover
30
key={id}
31
placement="bottom"
32
trigger="click"
33
destroyOnHidden
34
open={open}
35
onOpenChange={onOpenChange}
36
content={content}
37
overlayInnerStyle={{ maxWidth: 545 }}
38
>
39
<span style={{ display: "inline-block" }}>
40
<Button
41
type={type}
42
size="small"
43
icon={<Icon name="forward" />}
44
aria-label={ariaLabel}
45
/>
46
</span>
47
</Popover>
48
);
49
}
50
51