mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-29 13:13:54 +08:00

* [questions][ui] Add DiscardDraftModal * [questions][ui] add question draft dialog form * [questions][ui] refactor bottom contribute bar * [questions][ui] landing page * [questions][ui] add similar question card * [questions][ui] use TIH dialog for discard * [questions][ui] add aria-hidden for select label * [questions][ui] extract useFormRegister hook * [questions][ui] change landing page to component * [questions][ui] load filter from query param * [question][chore] add constants.ts * [questions][ui] add app logo * [questions][ui] remove form * [questions][ui] fix dialog closing * [questions][chore] minor changes * [questions][ui] radio button * [questions][ui] add vertical scrolling * [questions][ui] Question age url param change * [questions][chore] refactor and add in todo * [questions][ui] contribute card clickable * [questions][ui] landing page github stars * [questions][ui] edit css for question card * [question][ui] add question detail page * [questions][ui] remove navbar import * [questions][ui] css changes * [questions][ui] hide sidebar * [questions][ui] contribute questions form ui * [questions][ui] question page * [questions][bug] remove button * [questions][ui] voting button size * [questions][chore] add dummy data, refactor * [questions][ui] answer card * [questions][chore] add sample data * [questions][ui] add hover * [questions][ui] clean up old href * [questions][ui] add comments & commments page * [question][feat] cache filter options to localStorage * [questions][fix] fix index refreshing constantly * [questions][ui] set fixed sample date Co-authored-by: Jeff Sieu <jeffsy00@gmail.com>
37 lines
961 B
TypeScript
37 lines
961 B
TypeScript
export type RadioProps = {
|
|
onChange: (value: string) => void;
|
|
radioData: Array<RadioData>;
|
|
};
|
|
|
|
export type RadioData = {
|
|
checked: boolean;
|
|
label: string;
|
|
value: string;
|
|
};
|
|
|
|
export default function RadioGroup({ radioData, onChange }: RadioProps) {
|
|
return (
|
|
<div className="mx-1 space-y-1">
|
|
{radioData.map((radio) => (
|
|
<div key={radio.value} className="flex items-center">
|
|
<input
|
|
checked={radio.checked}
|
|
className="text-primary-600 focus:ring-primary-500 h-4 w-4 border-gray-300"
|
|
type="radio"
|
|
value={radio.value}
|
|
onChange={(event) => {
|
|
const target = event.target as HTMLInputElement;
|
|
onChange(target.value);
|
|
}}
|
|
/>
|
|
<label
|
|
className="ml-3 min-w-0 flex-1 text-gray-700"
|
|
htmlFor={radio.value}>
|
|
{radio.label}
|
|
</label>
|
|
</div>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|