Skip to content

Commit 71f2890

Browse files
committed
chore(vscode): make buttons neater html
- makes the button not be wrapped with unncessary html blocks - gets rid of deprecated headless ui code
1 parent b043f25 commit 71f2890

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed
Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Menu } from '@headlessui/react'
1+
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react'
22
import { CheckIcon } from '@heroicons/react/24/outline'
33
import { CogIcon } from '@/components/graph/CogIcon'
44
import clsx from 'clsx'
@@ -17,39 +17,34 @@ export function SettingsControl({
1717
as="div"
1818
className="relative"
1919
>
20-
<Menu.Button
20+
<MenuButton
2121
className="react-flow__controls-button"
2222
title="Settings"
2323
>
2424
<CogIcon
2525
className="h-3 w-3"
2626
aria-hidden="true"
2727
/>
28-
</Menu.Button>
29-
<Menu.Items className="absolute bottom-0 left-full ml-2 w-56 origin-bottom-left divide-y bg-theme shadow-lg focus:outline-none z-50">
30-
<Menu.Item>
31-
{({ active }) => (
32-
<button
33-
className={clsx(
34-
'group flex w-full items-center px-2 py-1 text-sm',
35-
'text-[var(--vscode-button-foreground)]',
36-
active
37-
? 'bg-[var(--vscode-button-background)]'
38-
: 'bg-[var(--vscode-button-hoverBackground)]',
39-
)}
40-
onClick={() => onWithColumnsChange(!showColumns)}
41-
>
42-
<span className="flex-1 text-left">Show Columns</span>
43-
{showColumns && (
44-
<CheckIcon
45-
className="h-4 w-4 text-primary-500"
46-
aria-hidden="true"
47-
/>
48-
)}
49-
</button>
28+
</MenuButton>
29+
<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">
30+
<MenuItem
31+
as="button"
32+
className={clsx(
33+
'group flex w-full items-center px-2 py-1 text-sm',
34+
'text-[var(--vscode-button-foreground)]',
35+
'hover:bg-[var(--vscode-button-background)] bg-[var(--vscode-button-hoverBackground)]',
5036
)}
51-
</Menu.Item>
52-
</Menu.Items>
37+
onClick={() => onWithColumnsChange(!showColumns)}
38+
>
39+
<span className="flex-1 text-left">Show Columns</span>
40+
{showColumns && (
41+
<CheckIcon
42+
className="h-4 w-4 text-primary-500"
43+
aria-hidden="true"
44+
/>
45+
)}
46+
</MenuItem>
47+
</MenuItems>
5348
</Menu>
5449
)
5550
}

0 commit comments

Comments
 (0)