This repository has been archived by the owner on Jun 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Day.tsx
79 lines (74 loc) · 1.75 KB
/
Day.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import React, { FC } from 'react'
import cx from 'classnames'
import * as helper from '../../helper'
import { HandleOnDayClick, HandleOnDayEnter } from '../../@types'
interface Props {
blockClassName: string
date: Date
getDayFormatted: typeof helper.getDayFormatted
handleOnClick: HandleOnDayClick
handleOnEnter: HandleOnDayEnter
isCurrentMonth: boolean
isDisabled: boolean
isHighlighted: boolean
isMonthNext: boolean
isMonthPrev: boolean
isNonSelectable: boolean
ISODate: string
isSelectable: boolean
isSelected: boolean
isSelectionEnd: boolean
isSelectionStart: boolean
isToday: boolean
isWeekend: boolean
isWorkDay: boolean
key?: string
}
const Day: FC<Props> = ({
blockClassName,
date,
getDayFormatted,
handleOnClick,
handleOnEnter,
isCurrentMonth,
isDisabled,
isHighlighted,
isMonthNext,
isMonthPrev,
isNonSelectable,
ISODate,
isSelectable,
isSelected,
isSelectionEnd,
isSelectionStart,
isToday,
isWeekend,
isWorkDay
}) => (
<button
data-simple-react-calendar-day={ISODate}
className={cx(`${blockClassName}-week-day`, {
'is-current_month': isCurrentMonth,
'is-disabled': isDisabled,
'is-end_selection': isSelectionEnd,
'is-highlighted': isHighlighted,
'is-next_month': isMonthNext,
'is-not_selectable': isNonSelectable,
'is-prev_month': isMonthPrev,
'is-selectable': isSelectable,
'is-selected': isSelected,
'is-start_selection': isSelectionStart,
'is-today': isToday,
'is-weekend': isWeekend,
'is-working_day': isWorkDay
})}
onClick={handleOnClick}
onMouseEnter={handleOnEnter}
type='button'
value={ISODate}
>
{getDayFormatted(date)}
</button>
)
Day.displayName = 'Day'
export default Day