Files
github-stats-extended/apps/frontend/src/components/Generic/Select.tsx
T
Martin 4ea98d333d fixes around daisyUI upgrade (#74)
Yesterday I [upgraded
daisyUI](https://github.com/stats-organization/github-stats-extended/pull/69)
from 2.x to 5.x. That changed the visuals of a few components. This PR
fixes this. Part of the fix is modernizing our tailwind setup.
2026-02-11 19:47:06 +01:00

55 lines
1.1 KiB
TypeScript

import { clsx } from "clsx";
import type { JSX } from "react";
export interface SelectOption {
id: number;
value: string;
label: string;
disabled?: boolean;
}
interface SelectProps {
options: Array<SelectOption>;
selectedOption: SelectOption;
className?: string;
disabled?: boolean;
onOptionChange: (option: SelectOption) => void;
}
export function Select({
options,
selectedOption,
onOptionChange,
disabled,
className,
}: SelectProps): JSX.Element {
return (
<select
className={clsx(
"text-gray-700 text-base bg-white select select-sm w-40 rounded-sm mt-4",
className,
)}
value={selectedOption.value}
onChange={(e) => {
onOptionChange(options[e.target.selectedIndex] as SelectOption);
}}
disabled={disabled}
>
{options.map((option) => (
<option
key={option.value}
value={option.value}
disabled={option.disabled}
className={clsx({
"bg-blue-200": option.value === selectedOption.value,
})}
>
{option.label}
</option>
))}
</select>
);
}