found a solution for the menu items not rendering within HeadlessUI docs
This commit is contained in:
@@ -18,22 +18,8 @@ const AllShortcutsModal = () => {
|
|||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
useHotkeys(SHORTCUT, () => setOpen(!open), [open])
|
useHotkeys(SHORTCUT, () => setOpen(!open), [open])
|
||||||
const { state, thunkDispatch } = useIdeContext()
|
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<div className="hidden">
|
|
||||||
<Menu>
|
|
||||||
{ editorMenuConfig.filter(menu => menu.items.length).map(menu =>
|
|
||||||
menu.items.map(item => (
|
|
||||||
<item.component
|
|
||||||
state={state}
|
|
||||||
thunkDispatch={thunkDispatch}
|
|
||||||
config={item}
|
|
||||||
key={menu.label +"-"+ item.label } />
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</Menu>
|
|
||||||
</div>
|
|
||||||
<Dialog open={open} onClose={() => setOpen(false)} className={classes.root}>
|
<Dialog open={open} onClose={() => setOpen(false)} className={classes.root}>
|
||||||
<div className="bg-ch-gray-700 font-fira-sans max-w-7xl rounded shadow-lg text-ch-gray-300 p-4">
|
<div className="bg-ch-gray-700 font-fira-sans max-w-7xl rounded shadow-lg text-ch-gray-300 p-4">
|
||||||
<h2 className="text-2xl mb-4">All Shortcuts</h2>
|
<h2 className="text-2xl mb-4">All Shortcuts</h2>
|
||||||
|
|||||||
@@ -35,12 +35,14 @@ export function Dropdown({
|
|||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Menu>
|
<Menu>
|
||||||
|
{({ open }) => (<>
|
||||||
<Menu.Button className={"text-gray-100" + (disabled ? " text-gray-400 cursor-not-allowed" : "")} disabled={disabled}>{label}</Menu.Button>
|
<Menu.Button className={"text-gray-100" + (disabled ? " text-gray-400 cursor-not-allowed" : "")} disabled={disabled}>{label}</Menu.Button>
|
||||||
{ children &&
|
{ children &&
|
||||||
<Menu.Items className="absolute flex flex-col mt-4 bg-ch-gray-760 rounded text-gray-100 overflow-hidden whitespace-nowrap border border-ch-gray-700">
|
<Menu.Items static className={(open ? "" : "hidden ") + "absolute flex flex-col mt-4 bg-ch-gray-760 rounded text-gray-100 overflow-hidden whitespace-nowrap border border-ch-gray-700"}>
|
||||||
{children}
|
{children}
|
||||||
</Menu.Items>
|
</Menu.Items>
|
||||||
}
|
}
|
||||||
|
</>)}
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user