import React from 'react'; import InputError from '../Inputs/InputError'; interface Props { /** * callback function when the button is clicked */ callback: (v: React.ChangeEvent) => void; /** * An error message to be shown docked at the bottom of the input. If null, nothing will show. */ error?: string | null; /** * id of the element */ id?: string; /** * extra classes to be applied to the input itself */ inputClass?: string; /** * If true, will show an (optional) tag next to the title. If false or not supplied, nothing will show. */ optional?: boolean; /** * the list options of the button */ options?: Array; /** * If true, will show a required *'s. If false or not supplied, nothing will show. */ required?: boolean; /** * extra classes to be applied */ themeClass?: string; /** * The title of the label */ title: string; } interface Options { title: string; value: string | number; selected: boolean; } const SelectDropdown = ({ callback, error = null, id = 'nwc--select-dropdown', inputClass = 'border block radius--sm padding--sm font--14', optional = false, options = [ { title: '-- Select Something --', value: -1, selected: false }, { title: 'Option 1', value: '0', selected: true }, { title: 'Option 2', value: '1', selected: false }, ], required = false, themeClass = 'block', title, }: Props) => { return ( {error !== '' && error !== null && } ); }; export default SelectDropdown;