From f765776bbf4a4c7a15464b6380aa0f396d910c48 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 20 Apr 2022 09:42:27 +0430 Subject: [PATCH] update src/components/DateRangePicker/index.js and src/components/TestComponentNew/index.scss --- src/components/DateRangePicker/index.js | 66 ++++++++++------------ src/components/DateRangePicker/index.scss | 42 ++++++++++++++ src/components/TestComponentNew/index.scss | 13 +++-- 3 files changed, 80 insertions(+), 41 deletions(-) create mode 100644 src/components/DateRangePicker/index.scss diff --git a/src/components/DateRangePicker/index.js b/src/components/DateRangePicker/index.js index 2cd98c2..240ea9b 100644 --- a/src/components/DateRangePicker/index.js +++ b/src/components/DateRangePicker/index.js @@ -1,12 +1,14 @@ -import React, { useState, useEffect } from "react"; +import React, { useEffect } from "react"; + +import "./index.scss"; import { Calendar } from "react-multi-date-picker"; +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"; -import DatePanel from "react-multi-date-picker/plugins/date_panel"; -import DatePicker from "react-multi-date-picker"; +//بهتره که این آرایه خارج از کامپوننت اصلی قرار داده بشه. const weekDays = [ "شنبه", "یکشنبه", @@ -17,58 +19,50 @@ const weekDays = [ "جمعه", ]; -function CustomButton({ 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 DateRangePicker = () => { - const [shouldOpenCalendar, setShouldOpenCalendar] = useState(true); - return ( - <> +
+ +
false} + arrow={false} minDate={new Date()} - renderButton={} render={} - onClose={() => false} - calendarPosition="bottom-right" - // plugins={[]} + weekDays={weekDays} /> - +
); }; diff --git a/src/components/DateRangePicker/index.scss b/src/components/DateRangePicker/index.scss new file mode 100644 index 0000000..ebe7dad --- /dev/null +++ b/src/components/DateRangePicker/index.scss @@ -0,0 +1,42 @@ +.rmdp-arrow-container { + background-color: #3b98f3; + border-radius: 2px !important; + height: 24px !important; + width: 24px !important; +} + +.rmdp-arrow-container .rmdp-arrow { + border: solid #fff; + border-width: 0 2px 2px 0; + margin-top: 8px !important; +} + +.rmdp-wrapper .start { + background: #3b98f3 !important; + color: #fff !important; + border: none !important; + box-shadow: none !important; + border-top-right-radius: 4px !important; + border-bottom-right-radius: 4px !important; +} + +.rmdp-wrapper .end { + background: #3b98f3 !important; + color: #fff !important; + border: none !important; + box-shadow: none !important; + border-top-left-radius: 4px !important; + border-bottom-left-radius: 4px !important; +} + +.rmdp-range { + background: #f7f7f7 !important; + color: #3b98f3 !important; + border: none !important; + box-shadow: none !important; +} + +.rmdp-header-values span { + color: #12508e !important; + font-weight: bold !important; +} diff --git a/src/components/TestComponentNew/index.scss b/src/components/TestComponentNew/index.scss index 68ba1e7..d080051 100644 --- a/src/components/TestComponentNew/index.scss +++ b/src/components/TestComponentNew/index.scss @@ -5,10 +5,6 @@ width: 24px !important; } -.rmpd-day.rmdp-range.start { - background: red !important; -} - .rmdp-arrow-container .rmdp-arrow { border: solid #fff; border-width: 0 2px 2px 0; @@ -18,14 +14,21 @@ .rmdp-wrapper .start { background: #0074d9 !important; color: #fff !important; + border: none !important; + box-shadow: none !important; } .rmdp-wrapper .end { background: #0074d9 !important; color: #fff !important; + box-shadow: none !important; + + border: none !important; } .rmdp-range { - background: #f5f5f5 !important; + background: #f7f7f7 !important; color: #0074d9 !important; + border: none !important; + box-shadow: none !important; }