import { Button, Link, Note, Popover, Spacer } from '@geist-ui/core' import FileIcon from '@geist-ui/icons/fileText' import CodeIcon from '@geist-ui/icons/fileLambda' import styles from './dropdown.module.css' import { useCallback, useEffect, useState } from "react" import { codeFileExtensions } from "@lib/constants" import ChevronDown from '@geist-ui/icons/chevronDown' import ShiftBy from "@components/shift-by" import type { File } from '@lib/types' import FileTree from '@geist-ui/icons/list' type Item = File & { icon: JSX.Element } const FileDropdown = ({ files }: { files: File[] }) => { const [expanded, setExpanded] = useState(false) const [items, setItems] = useState([]) useEffect(() => { const newItems = files.map(file => { const extension = file.title.split('.').pop() if (codeFileExtensions.includes(extension || '')) { return { ...file, icon: } } else { return { ...file, icon: } } }) setItems(newItems) }, [files]) const content = useCallback(() => (
    {items.map(item => (
  • setExpanded(false)}> {item.icon} {item.title}
  • ))}
), [items]) // a list of files with an icon and a title return ( ) } export default FileDropdown