1- import { Fragment , useState } from 'react'
2- import { Menu , Transition } from '@headlessui/react'
3- import { CogIcon } from '@heroicons/react/24/solid'
1+ import { Fragment } from 'react'
2+ import {
3+ Menu ,
4+ Button ,
5+ Transition ,
6+ MenuItems ,
7+ MenuItem ,
8+ } from '@headlessui/react'
49import { CheckIcon } from '@heroicons/react/24/outline'
10+ import { CogIcon } from '@/components/graph/CogIcon'
511import clsx from 'clsx'
612
713interface SettingsControlProps {
8- settings : {
9- showColumns : boolean
10- }
11- onSettingChange : ( setting : string , value : boolean ) => void
14+ showColumns : boolean
15+ onWithColumnsChange : ( value : boolean ) => void
1216}
1317
1418export function SettingsControl ( {
15- settings ,
16- onSettingChange ,
19+ showColumns ,
20+ onWithColumnsChange ,
1721} : SettingsControlProps ) : JSX . Element {
1822 return (
19- < Menu as = "div" className = "relative" >
20- < Menu . Button className = "react-flow__controls-button" title = "Settings" >
21- < CogIcon className = "h-3 w-3" aria-hidden = "true" />
23+ < Menu
24+ as = "div"
25+ className = "relative"
26+ >
27+ < Menu . Button
28+ className = "react-flow__controls-button"
29+ title = "Settings"
30+ >
31+ < CogIcon
32+ className = "h-3 w-3"
33+ aria-hidden = "true"
34+ />
2235 </ Menu . Button >
2336 < Transition
2437 as = { Fragment }
@@ -29,7 +42,7 @@ export function SettingsControl({
2942 leaveFrom = "transform opacity-100 scale-100"
3043 leaveTo = "transform opacity-0 scale-95"
3144 >
32- < Menu . Items className = "absolute bottom-full mb-2 right -0 w-56 origin-bottom-right divide-y divide-neutral-100 dark:divide-neutral-800 rounded-md bg-theme shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none z-50" >
45+ < Menu . Items className = "absolute bottom-full mb-2 left -0 w-56 origin-bottom-left divide-y divide-neutral-100 dark:divide-neutral-800 rounded-md bg-theme shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none z-50" >
3346 < div className = "px-1 py-1" >
3447 < Menu . Item >
3548 { ( { active } ) => (
@@ -38,13 +51,16 @@ export function SettingsControl({
3851 'group flex w-full items-center rounded-md px-2 py-2 text-sm' ,
3952 active
4053 ? 'bg-primary-10 text-primary-500'
41- : 'text-neutral-700 dark:text-neutral-300'
54+ : 'text-neutral-700 dark:text-neutral-300' ,
4255 ) }
43- onClick = { ( ) => onSettingChange ( 'showColumns' , ! settings . showColumns ) }
56+ onClick = { ( ) => onWithColumnsChange ( ! showColumns ) }
4457 >
4558 < span className = "flex-1 text-left" > Show Columns</ span >
46- { settings . showColumns && (
47- < CheckIcon className = "h-4 w-4 text-primary-500" aria-hidden = "true" />
59+ { showColumns && (
60+ < CheckIcon
61+ className = "h-4 w-4 text-primary-500"
62+ aria-hidden = "true"
63+ />
4864 ) }
4965 </ button >
5066 ) }
@@ -54,4 +70,4 @@ export function SettingsControl({
5470 </ Transition >
5571 </ Menu >
5672 )
57- }
73+ }
0 commit comments