import React, { useState } from "react"; const Month = ({ items }) => { const [selectedYear, setSelectedYear] = useState(null); return (
{items.map((item, index) => ( setSelectedYear(selectedYear === item ? null : item)} className={`text-xs my-2 cursor-pointer ${ selectedYear === item ? "text-[#06BACE] font-bold " : "" }`} key={index} > {item.month} ))}
); }; export default Month; Month.defaultProps = { items: [ { month: "فروردین", }, { month: "اردیبهشت", }, { month: "خرداد", }, { month: "تیر", }, { month: "مرداد", }, { month: "شهریور", }, { month: "مهر", }, { month: "آبان", }, { month: "آذر", }, { month: "دی", }, { month: "بهمن", }, { month: "اسفند", }, ], };