Skip to content

Commit 226d03f

Browse files
(Datepicker): update markups and classnames
1 parent d27457c commit 226d03f

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

src/scripts/Datepicker.tsx

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -141,39 +141,38 @@ const DatepickerFilter: FC<DatepickerFilterProps> = (props) => {
141141
const onNextMonth = useEventCallback(() => onMonthChange(1));
142142
return (
143143
<div className='slds-datepicker__filter slds-grid'>
144-
<div className='slds-datepicker__filter_month slds-grid slds-grid_align-spread slds-size_2-of-3'>
144+
<div className='slds-datepicker__filter_month slds-grid slds-grid_align-spread slds-grow'>
145145
<div className='slds-align-middle'>
146146
<Button
147-
className='slds-align-middle'
148147
type='icon-container'
149148
icon='left'
150-
size='small'
151149
alt='Previous Month'
152150
onClick={onPrevMonth}
153151
/>
154152
</div>
155153
<h2 className='slds-align-middle'>{dayjs.monthsShort()[cal.month]}</h2>
156154
<div className='slds-align-middle'>
157155
<Button
158-
className='slds-align-middle'
159156
type='icon-container'
160157
icon='right'
161-
size='small'
162158
alt='Next Month'
163159
onClick={onNextMonth}
164160
/>
165161
</div>
166162
</div>
167-
<div className='slds-size_1-of-3'>
168-
<Select value={cal.year} onChange={onYearChange}>
169-
{new Array(11)
170-
.join('_')
171-
.split('_')
172-
.map((a, i) => {
173-
const year = cal.year + i - 5;
174-
return <Option key={year} label={String(year)} value={year} />;
175-
})}
176-
</Select>
163+
<div className='slds-shrink-none'>
164+
<label className='slds-assistive-text'>Pick a Year</label>
165+
<div className='slds-select_container'>
166+
<Select value={cal.year} onChange={onYearChange}>
167+
{new Array(11)
168+
.join('_')
169+
.split('_')
170+
.map((a, i) => {
171+
const year = cal.year + i - 5;
172+
return <Option key={year} label={String(year)} value={year} />;
173+
})}
174+
</Select>
175+
</div>
177176
</div>
178177
</div>
179178
);
@@ -241,10 +240,12 @@ const DatepickerDate: FC<DatepickerDateProps> = (props) => {
241240
}
242241
const selected = date.value === selectedDate;
243242
const isToday = date.value === today;
243+
const isAdjacentMonth = date.month !== cal.month;
244244
const dateClassName = classnames({
245245
'slds-disabled-text': !enabled,
246246
'slds-is-selected': selected,
247247
'slds-is-today': isToday,
248+
'slds-day_adjacent-month': isAdjacentMonth,
248249
});
249250
return (
250251
<td
@@ -292,12 +293,7 @@ const DatepickerMonth = forwardRef(
292293
onDateKeyDown,
293294
} = props;
294295
return (
295-
<table
296-
ref={ref}
297-
className='datepicker__month'
298-
role='grid'
299-
aria-labelledby='month'
300-
>
296+
<table ref={ref} className='slds-datepicker__month' role='grid'>
301297
<thead>
302298
<tr>
303299
{dayjs.weekdaysMin(true).map((wd, i) => (

0 commit comments

Comments
 (0)