element-call/src/GridLayoutMenu.jsx

37 lines
1.3 KiB
React
Raw Normal View History

2021-12-07 19:59:57 +00:00
import React from "react";
import { ButtonTooltip, Button } from "./button";
2021-12-07 01:34:10 +00:00
import { PopoverMenuTrigger } from "./PopoverMenu";
2021-12-04 00:42:29 +00:00
import { ReactComponent as SpotlightIcon } from "./icons/Spotlight.svg";
import { ReactComponent as FreedomIcon } from "./icons/Freedom.svg";
import { ReactComponent as CheckIcon } from "./icons/Check.svg";
import styles from "./GridLayoutMenu.module.css";
2021-12-07 01:34:10 +00:00
import { Menu } from "./Menu";
import { Item } from "@react-stately/collections";
2021-12-04 00:42:29 +00:00
export function GridLayoutMenu({ layout, setLayout }) {
return (
2021-12-07 01:34:10 +00:00
<PopoverMenuTrigger placement="bottom right">
2021-12-07 19:59:57 +00:00
<Button variant="icon">
2021-12-04 00:42:29 +00:00
<ButtonTooltip>Layout Type</ButtonTooltip>
{layout === "spotlight" ? <SpotlightIcon /> : <FreedomIcon />}
2021-12-07 19:59:57 +00:00
</Button>
2021-12-04 00:42:29 +00:00
{(props) => (
2021-12-07 01:34:10 +00:00
<Menu {...props} label="Grid layout menu" onAction={setLayout}>
<Item key="freedom" textValue="Freedom">
2021-12-04 00:42:29 +00:00
<FreedomIcon />
<span>Freedom</span>
{layout === "freedom" && <CheckIcon className={styles.checkIcon} />}
2021-12-07 01:34:10 +00:00
</Item>
<Item key="spotlight" textValue="Spotlight">
2021-12-04 00:42:29 +00:00
<SpotlightIcon />
<span>Spotlight</span>
{layout === "spotlight" && (
<CheckIcon className={styles.checkIcon} />
)}
2021-12-07 01:34:10 +00:00
</Item>
</Menu>
2021-12-04 00:42:29 +00:00
)}
2021-12-07 01:34:10 +00:00
</PopoverMenuTrigger>
2021-12-04 00:42:29 +00:00
);
}