Make name not required in OptionButtons Componet
This commit is contained in:
1 file changed
+9
-9
@@ -1,21 +1,21 @@
|
||||
import './OptionButtons.css'
|
||||
|
||||
type ButtonOption = {
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
};
|
||||
label: string
|
||||
onClick: () => void
|
||||
}
|
||||
|
||||
type OptionButtonsProps = {
|
||||
buttons: ButtonOption[];
|
||||
name: string;
|
||||
};
|
||||
buttons: ButtonOption[]
|
||||
name: string | null
|
||||
}
|
||||
|
||||
export default function OptionButtons ({ buttons, name }: OptionButtonsProps) {
|
||||
return (
|
||||
<>
|
||||
<div className='container'>
|
||||
<h2>{name}</h2>
|
||||
<div className="flex gap-2">
|
||||
<h2 style={{ display: name == null ? 'none' : 'block' }}>{name}</h2>
|
||||
<div className='flex gap-2'>
|
||||
{buttons.map((btn, index) => (
|
||||
<button key={index} onClick={btn.onClick}>
|
||||
{btn.label}
|
||||
@@ -24,5 +24,5 @@ export default function OptionButtons({ buttons, name }: OptionButtonsProps) {
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user