import styles from "./Section.module.css";
import { ComponentPropsWithoutRef, ReactNode } from "react";

type SectionProps = {
  children: ReactNode;
  gridArea?: string;
  bgColor?: string;
  className?: string;
} & Omit<ComponentPropsWithoutRef<"section">, "className" | "children">;

const Section = (props: SectionProps) => {
  const {
    children,
    gridArea = "wide",
    bgColor = "",
    className = "",
    ...rest
  } = props;

  const classNames = [
    styles.section,
    styles[gridArea],
    styles[bgColor],
    className,
  ];

  return (
    <section className={classNames.join(" ").trim()} {...rest}>
      {children}
    </section>
  );
};

export default Section;
