import InputBase from '@mui/material/InputBase' import Paper from '@mui/material/Paper' import MAutocomplete from '@mui/material/Autocomplete' import classnames from 'classnames' import React, { memo, useState } from 'react' import { P } from './typography' import SearchIcon from '../styling/icons/circle buttons/search/zodiac.svg?react' const SearchBox = memo( ({ loading = false, filters = [], options = [], inputPlaceholder = '', onChange, ...props }) => { const [popupOpen, setPopupOpen] = useState(false) const inputClasses = { 'flex flex-1 h-8 px-2 py-2 font-md items-center rounded-2xl bg-zircon text-comet': true, 'rounded-b-none': popupOpen, } const innerOnChange = filters => onChange(filters) return ( it.label || it.value} renderOption={(props, it) => (
  • {it.label || it.value}

    {it.type}

  • )} autoHighlight disableClearable clearOnEscape multiple filterSelectedOptions isOptionEqualToValue={(option, value) => option.type === value.type} renderInput={params => { return ( } placeholder={inputPlaceholder} inputProps={{ className: 'font-bold', ...params.inputProps, }} /> ) }} onOpen={() => setPopupOpen(true)} onClose={() => setPopupOpen(false)} onChange={(_, filters) => innerOnChange(filters)} {...props} slots={{ paper: ({ children }) => (
    {children} ), }} /> ) }, ) export default SearchBox