import { ChevronDown, SortAsc, SortDesc } from 'lucide-react' import { useEffect, useRef, useState } from 'react' import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from 'ui' export const HeaderCell = ({ col, setSortByValue, }: { col: any setSortByValue: (value: string) => void }) => { const ref = useRef(0) const [open, setOpen] = useState(false) useEffect(() => { ref.current = Number(new Date()) }, [open]) return (

{col.name}

{['created_at', 'email', 'phone'].includes(col.id) && ( { // [Joshen] This is a temp hack between the DropdownMenu and react data grid // as the header cell is selectable, which takes the focus away from the dropdown menu // causing it to close immediately. if (val === false && Number(new Date()) - ref.current > 100) setOpen(val) }} >
) }