web/plugins/DatePickerIran/page.jsx

61 lines
1.6 KiB
React
Raw Normal View History

2023-10-19 20:02:54 +03:30
"use client";
2023-10-21 15:57:05 +03:30
import React, { useContext, useEffect, useState } from "react";
2023-10-19 20:02:54 +03:30
import "@hassanmojab/react-modern-calendar-datepicker/lib/DatePicker.css";
import DatePicker from "@hassanmojab/react-modern-calendar-datepicker";
import Buttonbriz from "plugins/Buttonbriz/page";
import { Calendar } from "react-modern-calendar-datepicker";
2023-10-21 15:57:05 +03:30
import AppContext from "@ctx/AppContext";
2023-10-19 20:02:54 +03:30
2023-11-20 00:07:55 +03:30
const DatePickerIran = ({
datePickerEvent,
date,
zindex,
title,
validator,
validatorData,
name,
}) => {
2023-10-21 15:57:05 +03:30
const CTX = useContext(AppContext);
2023-10-19 20:02:54 +03:30
const [selectedDay, setSelectedDay] = useState(null);
2023-10-21 15:57:05 +03:30
const goToEditUser = CTX.state.goToEditUser;
// useEffect(() => {
// if (goToEditUser) {
// setSelectedDay(date);
// }
// }, []);
2023-10-21 11:14:11 +03:30
2023-10-19 20:02:54 +03:30
return (
<div className="">
2023-10-26 00:26:44 +03:30
<div
className={`flex justify-end relative top-[22px] right-3 ltr ${zindex}`}
>
2023-10-19 20:02:54 +03:30
<div className="bg-body-100 px-2">
2023-11-20 00:07:55 +03:30
<p className="mb-0 text-sm mr-0 mx-auto">{title}</p>
2023-10-19 20:02:54 +03:30
</div>
</div>
<DatePicker
2023-10-21 15:57:05 +03:30
value={date}
2023-10-21 11:14:11 +03:30
onChange={datePickerEvent}
2023-10-19 20:02:54 +03:30
shouldHighlightWeekends
inputClassName={`peer w-full border-b placeholder:text-transparent relative !text-right ${
2 == 1 ? "form-control-white" : "form-control"
}`}
2023-10-21 11:14:11 +03:30
locale="fa"
2023-11-20 00:07:55 +03:30
name={name}
2023-10-19 20:02:54 +03:30
/>
2023-11-20 00:07:55 +03:30
<div className="flex justify-start w-full absolute mt-[-2px]">
<small className="absolute ">
{" "}
{validator ? <>{validatorData}</> : ""}
</small>
</div>
2023-10-19 20:02:54 +03:30
</div>
);
};
export default DatePickerIran;