From 1249d98ac0a91e31df1f7c84f7513fa5f69d4730 Mon Sep 17 00:00:00 2001 From: jongomez Date: Thu, 28 Sep 2023 10:42:39 +0100 Subject: [PATCH] feat: added new class dayIsToday and rebased --- .../lsd-react/src/components/CSSBaseline/CSSBaseline.tsx | 3 +++ .../lsd-react/src/components/Calendar/Calendar.classes.ts | 1 + packages/lsd-react/src/components/Calendar/Day.tsx | 7 +++++-- packages/lsd-react/src/index.ts | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/lsd-react/src/components/CSSBaseline/CSSBaseline.tsx b/packages/lsd-react/src/components/CSSBaseline/CSSBaseline.tsx index 1b4c35d..f0e0388 100644 --- a/packages/lsd-react/src/components/CSSBaseline/CSSBaseline.tsx +++ b/packages/lsd-react/src/components/CSSBaseline/CSSBaseline.tsx @@ -77,6 +77,9 @@ const componentStyles: Array | SerializedStyles> = ModalStyles, ModalFooterStyles, ModalBodyStyles, + DatePickerStyles, + DateFieldStyles, + CalendarStyles, ] export const CSSBaseline: React.FC<{ theme?: Theme }> = ({ diff --git a/packages/lsd-react/src/components/Calendar/Calendar.classes.ts b/packages/lsd-react/src/components/Calendar/Calendar.classes.ts index 72eea89..0e1e79a 100644 --- a/packages/lsd-react/src/components/Calendar/Calendar.classes.ts +++ b/packages/lsd-react/src/components/Calendar/Calendar.classes.ts @@ -18,6 +18,7 @@ export const calendarClasses = { day: 'lsd-calendar-day', daySelected: 'lsd-calendar-day--selected', dayDisabled: 'lsd-calendar-day--disabled', + dayIsToday: 'lsd-calendar-day--today', todayIndicator: 'lsd-calendar-day__today_indicator', dayRange: 'lsd-calendar-day--range', } diff --git a/packages/lsd-react/src/components/Calendar/Day.tsx b/packages/lsd-react/src/components/Calendar/Day.tsx index 31f985d..4a9a369 100644 --- a/packages/lsd-react/src/components/Calendar/Day.tsx +++ b/packages/lsd-react/src/components/Calendar/Day.tsx @@ -43,6 +43,9 @@ export const Day = ({ day, date, disabled = false }: DayProps) => { return null } + const isToday = + new Date(date).setHours(0, 0, 0, 0) === new Date().setHours(0, 0, 0, 0) + return (