Good start to drag-n-drop sidebar!

This commit is contained in:
Gregory Schier
2023-03-18 14:41:07 -07:00
parent 3a7f0898f9
commit 91b818f98d
4 changed files with 450 additions and 90 deletions

View File

@@ -3,7 +3,7 @@ import { CheckIcon } from '@radix-ui/react-icons';
import classnames from 'classnames';
import { motion } from 'framer-motion';
import type { ForwardedRef, ReactElement, ReactNode } from 'react';
import { forwardRef, useImperativeHandle, useLayoutEffect, useState } from 'react';
import { forwardRef, memo, useImperativeHandle, useLayoutEffect, useState } from 'react';
export interface DropdownMenuRadioItem {
label: string;
@@ -64,7 +64,7 @@ export interface DropdownProps {
)[];
}
export function Dropdown({ children, items }: DropdownProps) {
export const Dropdown = memo(function Dropdown({ children, items }: DropdownProps) {
return (
<D.Root>
{children}
@@ -90,7 +90,7 @@ export function Dropdown({ children, items }: DropdownProps) {
</DropdownMenuPortal>
</D.Root>
);
}
});
interface DropdownMenuPortalProps {
children: ReactNode;