28 lines
541 B
TypeScript
28 lines
541 B
TypeScript
import {Menu} from '@headlessui/react';
|
|
import React from 'react';
|
|
|
|
export type PropsPartion = {
|
|
disabled?: boolean | undefined;
|
|
active?: boolean | undefined;
|
|
};
|
|
|
|
type Props = {
|
|
children: React.ReactElement<
|
|
any & PropsPartion
|
|
>;
|
|
} & PropsPartion;
|
|
|
|
/**
|
|
* Context menu item component
|
|
* @return {JSX.Element}
|
|
*/
|
|
export default function ContextMenuItem({children, ...props}: Props) {
|
|
return (
|
|
<Menu.Item {...props}>
|
|
{(params) => {
|
|
return React.cloneElement(children, params);
|
|
}}
|
|
</Menu.Item>
|
|
);
|
|
}
|