parent
9b5d517a5c
commit
b3c9751f09
4 changed files with 120 additions and 107 deletions
@ -1,76 +1,7 @@ |
||||
import React, { useState, 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"; |
||||
|
||||
//بهتره که این آرایه خارج از کامپوننت اصلی قرار داده بشه.
|
||||
// const weekDays = [
|
||||
// "شنبه",
|
||||
// "یکشنبه",
|
||||
// "دوشنبه",
|
||||
// "سشنبه",
|
||||
// "چهارشنبه",
|
||||
// "پنجشنبه",
|
||||
// "جمعه",
|
||||
// ];
|
||||
|
||||
function CustomRangeInput({ openCalendar, value }) { |
||||
useEffect(() => { |
||||
openCalendar(); |
||||
}, []); |
||||
|
||||
return ( |
||||
<div className="flex flex-row items-center "> |
||||
<input |
||||
className="w-full py-1 text-center text-sm rounded border border-gray-200 focus:outline-none focus:border-[#0074d9] focus:ring-[#0074d9] focus:ring-1" |
||||
onFocus={openCalendar} |
||||
value={value[0]} |
||||
readOnly |
||||
/> |
||||
<p className="mx-2 text-sm">تا</p> |
||||
<input |
||||
className="w-full py-1 text-center text-sm rounded border border-gray-200 focus:outline-none focus:border-[#0074d9] focus:ring-[#0074d9] focus:ring-1" |
||||
onFocus={openCalendar} |
||||
value={value[1]} |
||||
readOnly |
||||
/> |
||||
</div> |
||||
); |
||||
} |
||||
import React from "react"; |
||||
|
||||
const TestComponentNew = () => { |
||||
return ( |
||||
<div className="w-1/2 mx-auto" style={{ direction: "rtl" }}> |
||||
<Calendar calendar={persian} locale={persian_fa} /> |
||||
<hr className="my-20" /> |
||||
<DatePicker |
||||
range |
||||
calendar={persian} |
||||
locale={persian_fa} |
||||
fixMainPosition={true} |
||||
fixRelativePosition={true} |
||||
calendarPosition={`${"top"}-${"center"}`} |
||||
offsetY={"10"} |
||||
onClose={() => false} |
||||
arrow={false} |
||||
minDate={new Date()} |
||||
render={<CustomRangeInput />} |
||||
// weekDays={weekDays}
|
||||
className="custom-calendar" |
||||
style={{ |
||||
width: "100%", |
||||
height: "33px", |
||||
boxSizing: "border-box", |
||||
backgroundColor: "red", |
||||
}} |
||||
/> |
||||
</div> |
||||
); |
||||
return <div>TestComponentNew</div>; |
||||
}; |
||||
|
||||
export default TestComponentNew; |
||||
|
@ -1,34 +0,0 @@ |
||||
.rmdp-arrow-container { |
||||
background-color: #0074d9; |
||||
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: #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: #f7f7f7 !important; |
||||
color: #0074d9 !important; |
||||
border: none !important; |
||||
box-shadow: none !important; |
||||
} |
Loading…
Reference in new issue