Add more settings

This commit is contained in:
Sacha Weatherstone
2021-08-08 18:15:52 +10:00
parent 831d06cfb2
commit aff46494e9
4 changed files with 200 additions and 97 deletions
+38
View File
@@ -0,0 +1,38 @@
import React from 'react';
type DefaultSelectProps = JSX.IntrinsicElements['select'];
export interface SelectProps {
options: {
value: string;
label: string;
}[];
label: string;
}
export const Select = React.forwardRef<
HTMLSelectElement,
SelectProps & DefaultSelectProps
>(function Select(
{ options, label, id, ...props }: SelectProps & DefaultSelectProps,
ref,
) {
return (
<div className="space-y-1">
<label htmlFor={id} className="block text-sm font-medium dark:text-white">
{label}
</label>
<select
ref={ref}
{...props}
className="block w-full p-2 border dark:border-gray-600 rounded-md shadow-sm dark:bg-secondaryDark"
>
{options.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
</div>
);
});