element-call/src/room/GridLayoutMenu.jsx

40 lines
1.4 KiB
React
Raw Normal View History

2021-12-07 19:59:57 +00:00
import React from "react";
2022-01-06 00:58:55 +00:00
import { Button } from "../button";
2022-01-06 01:21:30 +00:00
import { PopoverMenuTrigger } from "../popover/PopoverMenu";
2022-01-06 00:58:55 +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";
2021-12-04 00:42:29 +00:00
import styles from "./GridLayoutMenu.module.css";
2022-01-06 00:58:55 +00:00
import { Menu } from "../Menu";
2021-12-07 01:34:10 +00:00
import { Item } from "@react-stately/collections";
2022-01-06 00:58:55 +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>
2022-01-20 21:03:54 +00:00
{() => "Layout Type"}
2021-12-15 06:00:00 +00:00
</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
);
}