parent
517175d636
commit
1d9f4efa7c
5 changed files with 144 additions and 101 deletions
@ -1,27 +1,83 @@ |
|||||||
import React, { useState } from "react"; |
import React, { useState } from "react"; |
||||||
import './index.css'; |
import './index.css'; |
||||||
import Calendar from "./CalendarComponents/Calendar"; |
import Calendar from "./CalendarComponents/Calendar"; |
||||||
import { utils } from "./CalendarComponents"; |
import { utils } from "./CalendarComponents"; |
||||||
|
|
||||||
import './index.css'; |
import './index.css'; |
||||||
|
|
||||||
const SimpleCalendar = () =>{ |
const SimpleCalendar = () => { |
||||||
const [selectedDay, setSelectedDay] = useState(null); |
const [selectedDay, setSelectedDay] = useState(null); |
||||||
|
|
||||||
|
|
||||||
return( |
return ( |
||||||
<div className="flex items-center justify-center w-full my-2"> |
<div className="flex items-center justify-center w-full my-2"> |
||||||
|
|
||||||
<Calendar |
<Calendar |
||||||
value={selectedDay} |
value={selectedDay} |
||||||
onChange={setSelectedDay} |
onChange={setSelectedDay} |
||||||
shouldHighlightWeekends |
shouldHighlightWeekends |
||||||
renderFooter={() => <center><button className="GoToTodayButton" onClick={() => setSelectedDay(utils('fa').getToday())}> امروز </button></center>} |
renderFooter={() => <center><button className="GoToTodayButton" onClick={() => setSelectedDay(utils('fa').getToday())}> امروز </button></center>} |
||||||
locale="fa"
|
locale="fa" |
||||||
|
events={eventsList} |
||||||
/> |
/> |
||||||
</div> |
</div> |
||||||
); |
); |
||||||
}; |
}; |
||||||
|
|
||||||
|
const eventsList = [ |
||||||
|
{ |
||||||
|
id: 2, |
||||||
|
description: "تست 2", |
||||||
|
type: "global", |
||||||
|
isHoliday: true, |
||||||
|
date: "2022-01-04T00:00:00.000Z", |
||||||
|
year: 2022, |
||||||
|
month: 1, |
||||||
|
day: 2 |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 4, |
||||||
|
description: "تست 4", |
||||||
|
type: "global", |
||||||
|
isHoliday: true, |
||||||
|
date: "2022-01-12T00:00:00.000Z", |
||||||
|
year: 2022, |
||||||
|
month: 1, |
||||||
|
day: 1 |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 1, |
||||||
|
description: "تست کاربر 1", |
||||||
|
type: "userDefined", |
||||||
|
userId: "5", |
||||||
|
date: "2022-01-12T00:00:00.000Z", |
||||||
|
categoryId: 1, |
||||||
|
year: 2022, |
||||||
|
month: 1, |
||||||
|
day: 3 |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 4, |
||||||
|
description: "تست کاربر 4", |
||||||
|
type: "userDefined", |
||||||
|
userId: "5", |
||||||
|
date: "2022-01-08T00:00:00.000Z", |
||||||
|
categoryId: 3, |
||||||
|
year: 2022, |
||||||
|
month: 1, |
||||||
|
day: 6 |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: 5, |
||||||
|
description: "تست کاربر 5", |
||||||
|
type: "userDefined", |
||||||
|
userId: "5", |
||||||
|
date: "2022-01-12T00:00:00.000Z", |
||||||
|
categoryId: 1, |
||||||
|
year: 2022, |
||||||
|
month: 1, |
||||||
|
day: 3 |
||||||
|
} |
||||||
|
]; |
||||||
|
|
||||||
export default SimpleCalendar; |
export default SimpleCalendar; |
Loading…
Reference in new issue