import { MetaTag, MetaTheme, SelectSearch, selectStyles, Tooltip, Wrap, WrapItem, } from '@metafam/ds'; import { Skill, SkillCategory_Enum } from 'graphql/autogen/types'; import { SkillColors } from 'graphql/types'; import React from 'react'; import { CategoryOption, SkillOption } from 'utils/skillHelpers'; export type SetupSkillsProps = { skillChoices: Array; skills: Array; setSkills: React.Dispatch>>; placeHolder: string; id?: string; }; export const SkillsSelect: React.FC = ({ skillChoices, skills, setSkills, placeHolder, id, }) => { const styles: typeof selectStyles = { ...selectStyles, multiValue: (s, { data }) => ({ ...s, background: SkillColors[data.category as SkillCategory_Enum], color: MetaTheme.colors.white, }), multiValueLabel: (s, { data }) => ({ ...s, background: SkillColors[data.category as SkillCategory_Enum], color: MetaTheme.colors.white, }), groupHeading: (s, { children }) => ({ ...s, ...(selectStyles.groupHeading && selectStyles.groupHeading(s, { children })), background: SkillColors[children as SkillCategory_Enum], }), }; return ( setSkills(value as Array)} options={skillChoices} autoFocus closeMenuOnSelect={false} placeholder={placeHolder} id={`skills-select-container-${id || ''}`} inputId={`skills-select-input-${id || ''}`} /> ); }; interface SkillsProps { skills: Skill[]; maxSkills?: number; } export const SkillsTags: React.FC = ({ maxSkills = 4, skills, }) => ( {skills.slice(0, maxSkills).map((skill) => ( {skill.name} ))} {skills.length > maxSkills && ( {`+${skills.length - maxSkills}`} )} );