Make name not required in OptionButtons Componet
This commit is contained in:
2 files changed
+11
-11
No files matched your search
@@ -13,4 +13,4 @@ h2 {
|
||||
.container {
|
||||
@apply bg-[rgb(24,24,36)] mt-5 p-5 border border-[rgb(48,48,72)] rounded-lg;
|
||||
@apply justify-center mx-auto w-fit flex flex-col gap-2;
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
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