You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.1 KiB

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