parent
517175d636
commit
1d9f4efa7c
5 changed files with 144 additions and 101 deletions
@ -1,27 +1,83 @@ |
||||
import React, { useState } from "react"; |
||||
import './index.css'; |
||||
import Calendar from "./CalendarComponents/Calendar"; |
||||
import Calendar from "./CalendarComponents/Calendar"; |
||||
import { utils } from "./CalendarComponents"; |
||||
|
||||
import './index.css'; |
||||
|
||||
const SimpleCalendar = () =>{ |
||||
const SimpleCalendar = () => { |
||||
const [selectedDay, setSelectedDay] = useState(null); |
||||
|
||||
|
||||
return( |
||||
return ( |
||||
<div className="flex items-center justify-center w-full my-2"> |
||||
|
||||
<Calendar |
||||
value={selectedDay} |
||||
onChange={setSelectedDay} |
||||
shouldHighlightWeekends |
||||
renderFooter={() => <center><button className="GoToTodayButton" onClick={() => setSelectedDay(utils('fa').getToday())}> امروز </button></center>} |
||||
locale="fa"
|
||||
value={selectedDay} |
||||
onChange={setSelectedDay} |
||||
shouldHighlightWeekends |
||||
renderFooter={() => <center><button className="GoToTodayButton" onClick={() => setSelectedDay(utils('fa').getToday())}> امروز </button></center>} |
||||
locale="fa" |
||||
events={eventsList} |
||||
/> |
||||
</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; |
Loading…
Reference in new issue