-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathSettingsControl.tsx
More file actions
50 lines (48 loc) · 1.46 KB
/
SettingsControl.tsx
File metadata and controls
50 lines (48 loc) · 1.46 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
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react'
import { CheckIcon } from '@heroicons/react/24/outline'
import { CogIcon } from '@/components/graph/CogIcon'
import clsx from 'clsx'
interface SettingsControlProps {
showColumns: boolean
onWithColumnsChange: (value: boolean) => void
}
export function SettingsControl({
showColumns,
onWithColumnsChange,
}: SettingsControlProps): JSX.Element {
return (
<Menu
as="div"
className="relative"
>
<MenuButton
className="react-flow__controls-button"
title="Settings"
>
<CogIcon
className="h-3 w-3"
aria-hidden="true"
/>
</MenuButton>
<MenuItems className="absolute bottom-0 left-full ml-2 w-56 origin-bottom-left divide-y bg-theme shadow-lg focus:outline-none z-50">
<MenuItem
as="button"
className={clsx(
'group flex w-full items-center px-2 py-1 text-sm',
'text-[var(--vscode-button-foreground)]',
'hover:bg-[var(--vscode-button-background)] bg-[var(--vscode-button-hoverBackground)]',
)}
onClick={() => onWithColumnsChange(!showColumns)}
>
<span className="flex-1 text-left">Show Columns</span>
{showColumns && (
<CheckIcon
className="h-4 w-4 text-primary-500"
aria-hidden="true"
/>
)}
</MenuItem>
</MenuItems>
</Menu>
)
}