diff --git a/packages/lsd-react/src/components/Calendar/Calendar.classes.ts b/packages/lsd-react/src/components/Calendar/Calendar.classes.ts index 29478ef..86c09dd 100644 --- a/packages/lsd-react/src/components/Calendar/Calendar.classes.ts +++ b/packages/lsd-react/src/components/Calendar/Calendar.classes.ts @@ -30,4 +30,7 @@ export const calendarClasses = { todayIndicator: 'lsd-calendar-day__today_indicator', monthTable: 'lsd-calendar__month-table', + + nextMonthButton: 'lsd-calendar__next-month-button', + previousMonthButton: 'lsd-calendar__previous-month-button', } diff --git a/packages/lsd-react/src/components/Calendar/Calendar.context.ts b/packages/lsd-react/src/components/Calendar/Calendar.context.ts index 4e0e84c..b9c4690 100644 --- a/packages/lsd-react/src/components/Calendar/Calendar.context.ts +++ b/packages/lsd-react/src/components/Calendar/Calendar.context.ts @@ -18,8 +18,6 @@ export type CalendarContextType = { goToNextMonths: () => void goToNextYear: () => void goToPreviousYear: () => void - changeYearMode: boolean - setChangeYearMode: (value: boolean) => void } export const CalendarContext = React.createContext( diff --git a/packages/lsd-react/src/components/Calendar/Calendar.styles.ts b/packages/lsd-react/src/components/Calendar/Calendar.styles.ts index 5a185de..8cb1907 100644 --- a/packages/lsd-react/src/components/Calendar/Calendar.styles.ts +++ b/packages/lsd-react/src/components/Calendar/Calendar.styles.ts @@ -14,12 +14,14 @@ export const CalendarStyles = css` padding: 0; box-sizing: border-box; background: rgb(var(--lsd-surface-primary)); + + user-select: none; + padding: 8px; } .${calendarClasses.container} { display: flex; flex-direction: column; - margin: 8px 2px 2px; } .${calendarClasses.open} { @@ -29,10 +31,10 @@ export const CalendarStyles = css` .${calendarClasses.header} { display: flex; - justify-content: space-between; + justify-content: center; align-items: center; - padding-inline: 10px; - padding-bottom: 10px; + height: 32px; + margin-bottom: 8px; } .${calendarClasses.weekDay} { @@ -40,6 +42,7 @@ export const CalendarStyles = css` justify-content: center; align-items: center; aspect-ratio: 1 / 1; + margin-bottom: 4px; } .${calendarClasses.row} { @@ -72,12 +75,6 @@ export const CalendarStyles = css` margin-right: 8px; } - .${calendarClasses.year}:hover { - cursor: pointer; - text-decoration: underline; - text-decoration-color: rgb(var(--lsd-border-primary)); - } - .${calendarClasses.dayContainer} { cursor: pointer; background: transparent; @@ -145,6 +142,18 @@ export const CalendarStyles = css` display: flex; align-items: center; justify-content: center; + + position: absolute; + } + + .${calendarClasses.nextMonthButton} { + top: 8px; + right: 8px; + } + + .${calendarClasses.previousMonthButton} { + top: 8px; + left: 8px; } /* Using style double instead of solid. When collapsing borders, */ diff --git a/packages/lsd-react/src/components/Calendar/Calendar.tsx b/packages/lsd-react/src/components/Calendar/Calendar.tsx index 3cbe6e6..d6c4547 100644 --- a/packages/lsd-react/src/components/Calendar/Calendar.tsx +++ b/packages/lsd-react/src/components/Calendar/Calendar.tsx @@ -67,7 +67,6 @@ export const Calendar: React.FC & { const [endDate, setEndDate] = useState( endDateProp ? safeConvertDate(endDateProp, minDate, maxDate).date : null, ) - const [changeYearMode, setChangeYearMode] = useState(false) useClickAway(ref, (event) => { if (!open) return @@ -183,8 +182,6 @@ export const Calendar: React.FC & { goToNextMonths, goToNextYear, goToPreviousYear, - changeYearMode, - setChangeYearMode, }} >
void + className?: string } export const CalendarNavigationButton: FC = ({ direction, onClick, + className, }) => { const Icon = direction === 'previous' ? NavigateBeforeIcon : NavigateNextIcon return (