GridRow.js 520 Bytes
import { moveDate, toYMD } from "../utils/Dates";
import GridItem from "./GridItem";

const GridRow = ({ startDate }) => {
  const { year, month, date } = startDate;

  const renderItems = () => {
    const items = [];
    const ndate = new Date(year, month - 1, date);

    for (let i = 0; i < 7; i++) {
      items.push(<GridItem key={i} targetDate={toYMD(ndate)} />);
      moveDate(ndate, "day", 1);
    }

    return items;
  };

  return <div className="GridRow">{renderItems()}</div>;
};

export default GridRow;