// import block import SimpleBar from 'simplebar-react'; import { Icon } from '../'; import { solid } from 'font-awesome-icon-chars'; import React, { useState } from 'react'; import { Box, Grid, Popover, TextField, IconButton } from '@mui/material'; // dashup ui color const DashupUIIconPicker = (props = {}) => { // use state const [search, setSearch] = useState(''); // get icons const getIcons = () => { // return icons return (solid || []).filter((icon) => { // icon return search && search.length ? icon.name.includes(`${search}`.toLowerCase()) : true; }).slice(0, 4 * 10); }; // on icon const onIcon = (e, name) => { // prevent default e.preventDefault(); e.stopPropagation(); // run super if (props.onChange) props.onChange(name); }; // return jsx return ( props.onClose(false) } anchorEl={ props.target?.current || props.target } anchorOrigin={ { vertical : 'bottom', horizontal : 'left', } } > setSearch(e.target.value) } /> { getIcons().map((icon) => { // return jsx return ( onIcon(e, icon.name) } color={ props.icon && props.icon.split(' ')[0] === icon.name ? 'primary' : undefined }> ); }) } ); }; // export default export default DashupUIIconPicker;