From 60d39f8f54440adbe333b55b5fc6ccc31b35f500 Mon Sep 17 00:00:00 2001 From: mahdi andalib Date: Tue, 19 Apr 2022 22:19:11 +0430 Subject: [PATCH] update App.js, src/components/DateRangePicker/index.js and src/components/TestComponentNew/index.js --- src/App.js | 2 +- src/components/DateRangePicker/index.js | 2 +- src/components/TestComponentNew/index.js | 54 +++++++++++++++++++++++- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/App.js b/src/App.js index 742495d..3d821b9 100644 --- a/src/App.js +++ b/src/App.js @@ -171,7 +171,7 @@ function App() { {/* */} {/* */} {/* */} - {/* */} + {/*
diff --git a/src/components/DateRangePicker/index.js b/src/components/DateRangePicker/index.js index ecbe741..2cd98c2 100644 --- a/src/components/DateRangePicker/index.js +++ b/src/components/DateRangePicker/index.js @@ -37,7 +37,7 @@ function CustomRangeInput({ openCalendar, value }) { // let from = value[0] || ""; // let to = value[1] || ""; - value = from && to ? "از " + from + "، تا " + to": from + // value = from && to ? "از " + from + "، تا " + to": from useEffect(() => { openCalendar(); }, []); diff --git a/src/components/TestComponentNew/index.js b/src/components/TestComponentNew/index.js index 80a509e..67925f3 100644 --- a/src/components/TestComponentNew/index.js +++ b/src/components/TestComponentNew/index.js @@ -1,4 +1,4 @@ -import React, { useRef, useState } from "react"; +import React, { useState, useEffect } from "react"; import "./index.scss"; @@ -8,7 +8,52 @@ import DatePicker from "react-multi-date-picker"; import persian from "react-date-object/calendars/persian"; import persian_fa from "react-date-object/locales/persian_fa"; +//بهتره که این آرایه خارج از کامپوننت اصلی قرار داده بشه. +const weekDays = [ + "شنبه", + "یکشنبه", + "دوشنبه", + "سشنبه", + "چهارشنبه", + "پنجشنبه", + "جمعه", +]; + +function DisablePassedDaies({ direction, handleClick, disabled }) { + return ( + + {direction === "right" ? ">" : "<"} + + ); +} + +function CustomRangeInput({ openCalendar, value }) { + // let from = value[0] || ""; + // let to = value[1] || ""; + + // value = from && to ? "از " + from + "، تا " + to": from + useEffect(() => { + openCalendar(); + }, []); + + return ( +
+ + +
+ ); +} const TestComponentNew = () => { + const [shouldOpenCalendar, setShouldOpenCalendar] = useState(false); + return (
{
false} arrow={false} + minDate={new Date()} + renderButton={} + render={} + weekDays={weekDays} inputClass="custom-input" className="custom-calendar" style={{