ByteGrad / Professional-React-and-Next.js-Course

This repo contains everything you need as a student of the Professional React & Next.js Course by ByteGrad.com
https://bytegrad.com/courses/professional-react-nextjs
111 stars 58 forks source link

ButtonGroup for trekbag has a bug #12

Open Rope-a-dope opened 1 month ago

Rope-a-dope commented 1 month ago

All buttons are not showing because the text is not passed, can be passed as children.

ButtonGroup

    <section className="button-group">
      {secondaryButtons.map((button) => (
        <Button
          key={button.text + button.onClick.toString()}
          onClick={button.onClick}
          buttonType="secondary"
        >
          {button.text}
        </Button>
      ))}
    </section>
export default function Button({ onClick, buttonType, children }) {
  return (
    <button
      onClick={onClick}
      className={`btn ${buttonType === "secondary" && "btn--secondary"}`}
    >
      {children}
    </button>
  );
}