diff --git a/src/components/Datepicker/Calender/index.js b/src/components/Datepicker/Calender/index.js new file mode 100644 index 0000000..7cdb715 --- /dev/null +++ b/src/components/Datepicker/Calender/index.js @@ -0,0 +1,38 @@ +import React from "react"; + +import { Calendar } 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 = [ + "شنبه", + "یکشنبه", + "دوشنبه", + "سشنبه", + "چهارشنبه", + "پنجشنبه", + "جمعه", +]; + +const Calender = () => { + return ( +
+ { + let props = {}; + let isWeekend = date.weekDay.index === 6; + + if (isWeekend) props.className = "highlight highlight-red"; + + return props; + }} + weekDays={weekDays} + arrow={false} + calendar={persian} + locale={persian_fa} + /> +
+ ); +}; + +export default Calender; diff --git a/src/components/Datepicker/CalenderList/index.js b/src/components/Datepicker/CalenderList/index.js index a1d459c..905ad69 100644 --- a/src/components/Datepicker/CalenderList/index.js +++ b/src/components/Datepicker/CalenderList/index.js @@ -1,36 +1,22 @@ import React from "react"; -import { Calendar } 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 = [ - "شنبه", - "یکشنبه", - "دوشنبه", - "سشنبه", - "چهارشنبه", - "پنجشنبه", - "جمعه", -]; +import Calender from "../Calender"; const CalenderList = () => { return ( -
- { - let props = {}; - let isWeekend = date.weekDay.index === 6; - - if (isWeekend) props.className = "highlight highlight-red"; - - return props; - }} - weekDays={weekDays} - arrow={false} - calendar={persian} - locale={persian_fa} - /> +
+ + + + + + + + + + + +
); }; diff --git a/src/components/Datepicker/index.js b/src/components/Datepicker/index.js index b292dc6..5c8f249 100644 --- a/src/components/Datepicker/index.js +++ b/src/components/Datepicker/index.js @@ -5,14 +5,16 @@ import RangeDatePicker from "./RangeDatePicker"; import SimpleCalendar from "./SimpleCalendar"; import SimpleDatePicker from "./SimpleDatePicker"; import CalenderList from "./CalenderList"; +import Calender from "./Calender"; -function Calender() { +function Datepicker() { const list = { 1: , 2: , 3: , 4: , 5: , + 6: , }; const [type, setType] = useState(1); return ( @@ -30,4 +32,4 @@ function Calender() { ); } -export default Calender; +export default Datepicker;