722c498abe
* Bump prettier from 1.19.1 to 2.0.1 Bumps [prettier](https://github.com/prettier/prettier) from 1.19.1 to 2.0.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/1.19.1...2.0.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Update formatting Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Panayiotis Lipiridis <lipiridis@gmail.com>
33 lines
674 B
TypeScript
33 lines
674 B
TypeScript
import React from "react";
|
|
|
|
export function ButtonSelect<T>({
|
|
options,
|
|
value,
|
|
onChange,
|
|
group,
|
|
}: {
|
|
options: { value: T; text: string }[];
|
|
value: T | null;
|
|
onChange: (value: T) => void;
|
|
group: string;
|
|
}) {
|
|
return (
|
|
<div className="buttonList">
|
|
{options.map((option) => (
|
|
<label
|
|
key={option.text}
|
|
className={value === option.value ? "active" : ""}
|
|
>
|
|
<input
|
|
type="radio"
|
|
name={group}
|
|
onChange={() => onChange(option.value)}
|
|
checked={value === option.value ? true : false}
|
|
/>
|
|
{option.text}
|
|
</label>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|