69061e20ac
* Rename ToolIcon to ToolButton It makes more semantic sense * Label and keyboard shortcuts announcement * Refactor common props for ToolButton * Better doc outline and form controls * Adjust color picker * Styling fixes Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
33 lines
672 B
TypeScript
33 lines
672 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>
|
|
);
|
|
}
|