mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Extract components and shapes into their respective modules (#212)
This commit is contained in:
parent
86a1c29eec
commit
054669cfef
5 changed files with 153 additions and 147 deletions
25
src/components/ButtonSelect.tsx
Normal file
25
src/components/ButtonSelect.tsx
Normal file
|
@ -0,0 +1,25 @@
|
|||
import React from "react";
|
||||
|
||||
export function ButtonSelect<T>({
|
||||
options,
|
||||
value,
|
||||
onChange
|
||||
}: {
|
||||
options: { value: T; text: string }[];
|
||||
value: T | null;
|
||||
onChange: (value: T) => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="buttonList">
|
||||
{options.map(option => (
|
||||
<button
|
||||
key={option.text}
|
||||
onClick={() => onChange(option.value)}
|
||||
className={value === option.value ? "active" : ""}
|
||||
>
|
||||
{option.text}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue