PluginProbe
Parse.ly / 3.14.1
Parse.ly v3.14.1
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
wp-parsely / src / content-helper / common / select.tsx

select.tsx in Parse.ly 3.14.1, at src/content-helper/common/select.tsx

35 lines 748 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Defines the props structure for FilterSelect.
3 *
4 * @since 3.10.0
5 */
6 interface FilterSelectProps {
7 defaultValue?: string;
8 items: [value: string, label: string][];
9 onChange: ( event: React.ChangeEvent<HTMLSelectElement> ) => void;
10 }
11
12 /**
13 * Returns a select element according to the passed props.
14 *
15 * @since 3.10.0
16 *
17 * @param {FilterSelectProps} props The component's props.
18 *
19 * @return {JSX.Element} The JSX Element.
20 */
21 export const Select = (
22 { defaultValue, items, onChange }: FilterSelectProps
23 ): JSX.Element => {
24 return (
25 <select onChange={ onChange } value={ defaultValue }>
26 { items.map( ( item ) => (
27 <option
28 key={ item[ 0 ] }
29 value={ item[ 0 ] }>{ item[ 1 ] }
30 </option>
31 ) ) }
32 </select>
33 );
34 };
35