2021-12-07 19:59:57 +00:00
|
|
|
import React from "react";
|
2021-12-15 06:00:00 +00:00
|
|
|
import { 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-15 06:00:00 +00:00
|
|
|
import { Tooltip, TooltipTrigger } from "./Tooltip";
|
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-15 06:00:00 +00:00
|
|
|
<TooltipTrigger>
|
|
|
|
<Button variant="icon">
|
|
|
|
{layout === "spotlight" ? <SpotlightIcon /> : <FreedomIcon />}
|
|
|
|
</Button>
|
|
|
|
{(props) => (
|
|
|
|
<Tooltip position="bottom" {...props}>
|
|
|
|
Layout Type
|
|
|
|
</Tooltip>
|
|
|
|
)}
|
|
|
|
</TooltipTrigger>
|
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
|
|
|
);
|
|
|
|
}
|