Skip to content

Commit 23c3016

Browse files
authored
chore: rm today style of other panel (#745)
* chore: rm today style * test: update snapshot
1 parent bbc3160 commit 23c3016

File tree

6 files changed

+21
-25
lines changed

6 files changed

+21
-25
lines changed

src/PickerPanel/DecadePanel/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import type { DisabledDate, SharedPanelProps } from '../../interface';
3-
import { formatValue, isSameDecade } from '../../utils/dateUtil';
3+
import { formatValue } from '../../utils/dateUtil';
44
import { PanelContext, useInfo } from '../context';
55
import PanelBody from '../PanelBody';
66
import PanelHeader from '../PanelHeader';
@@ -14,7 +14,7 @@ export default function DecadePanel<DateType extends object = any>(
1414
const panelPrefixCls = `${prefixCls}-decade-panel`;
1515

1616
// ========================== Base ==========================
17-
const [info, now] = useInfo(props, 'decade');
17+
const [info] = useInfo(props, 'decade');
1818
const startYear = Math.floor(generateConfig.getYear(pickerValue) / 100) * 100;
1919
const endYear = startYear + 99;
2020

@@ -49,7 +49,6 @@ export default function DecadePanel<DateType extends object = any>(
4949
const dateYear = generateConfig.getYear(date);
5050
return {
5151
[`${prefixCls}-cell-in-view`]: startYear <= dateYear && dateYear <= endYear,
52-
[`${prefixCls}-cell-today`]: isSameDecade(generateConfig, date, now),
5352
};
5453
};
5554

src/PickerPanel/MonthPanel/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import type { DisabledDate, SharedPanelProps } from '../../interface';
3-
import { formatValue, isSameMonth } from '../../utils/dateUtil';
3+
import { formatValue } from '../../utils/dateUtil';
44
import { PanelContext, useInfo } from '../context';
55
import PanelBody from '../PanelBody';
66
import PanelHeader from '../PanelHeader';
@@ -21,7 +21,7 @@ export default function MonthPanel<DateType extends object = any>(
2121
const panelPrefixCls = `${prefixCls}-month-panel`;
2222

2323
// ========================== Base ==========================
24-
const [info, now] = useInfo(props, 'month');
24+
const [info] = useInfo(props, 'month');
2525
const baseDate = generateConfig.setMonth(pickerValue, 0);
2626

2727
// ========================= Month ==========================
@@ -48,9 +48,8 @@ export default function MonthPanel<DateType extends object = any>(
4848
: monthsLocale[month];
4949
};
5050

51-
const getCellClassName = (date: DateType) => ({
51+
const getCellClassName = () => ({
5252
[`${prefixCls}-cell-in-view`]: true,
53-
[`${prefixCls}-cell-today`]: isSameMonth(generateConfig, date, now),
5453
});
5554

5655
// ======================== Disabled ========================

src/PickerPanel/QuarterPanel/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import type { SharedPanelProps } from '../../interface';
3-
import { formatValue, isSameQuarter } from '../../utils/dateUtil';
3+
import { formatValue } from '../../utils/dateUtil';
44
import { PanelContext, useInfo } from '../context';
55
import PanelBody from '../PanelBody';
66
import PanelHeader from '../PanelHeader';
@@ -14,7 +14,7 @@ export default function QuarterPanel<DateType extends object = any>(
1414
const panelPrefixCls = `${prefixCls}-quarter-panel`;
1515

1616
// ========================== Base ==========================
17-
const [info, now] = useInfo(props, 'quarter');
17+
const [info] = useInfo(props, 'quarter');
1818
const baseDate = generateConfig.setMonth(pickerValue, 0);
1919

2020
// ========================= Cells ==========================
@@ -30,9 +30,8 @@ export default function QuarterPanel<DateType extends object = any>(
3030
});
3131
};
3232

33-
const getCellClassName = (date: DateType) => ({
33+
const getCellClassName = () => ({
3434
[`${prefixCls}-cell-in-view`]: true,
35-
[`${prefixCls}-cell-today`]: isSameQuarter(generateConfig, date, now),
3635
});
3736

3837
// ========================= Header =========================

src/PickerPanel/YearPanel/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import type { DisabledDate, SharedPanelProps } from '../../interface';
3-
import { formatValue, isSameYear } from '../../utils/dateUtil';
3+
import { formatValue } from '../../utils/dateUtil';
44
import { PanelContext, useInfo } from '../context';
55
import PanelBody from '../PanelBody';
66
import PanelHeader from '../PanelHeader';
@@ -21,7 +21,7 @@ export default function YearPanel<DateType extends object = any>(
2121
const panelPrefixCls = `${prefixCls}-year-panel`;
2222

2323
// ========================== Base ==========================
24-
const [info, now] = useInfo(props, 'year');
24+
const [info] = useInfo(props, 'year');
2525
const startYear = Math.floor(generateConfig.getYear(pickerValue) / 10) * 10;
2626
const endYear = startYear + 9;
2727

@@ -47,7 +47,6 @@ export default function YearPanel<DateType extends object = any>(
4747
const dateYear = generateConfig.getYear(date);
4848
return {
4949
[`${prefixCls}-cell-in-view`]: startYear <= dateYear && dateYear <= endYear,
50-
[`${prefixCls}-cell-today`]: isSameYear(generateConfig, date, now),
5150
};
5251
};
5352

tests/__snapshots__/panel.spec.tsx.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ exports[`Picker.Panel append cell with cellRender in decade 1`] = `
876876
</div>
877877
</td>
878878
<td
879-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
879+
class="rc-picker-cell rc-picker-cell-in-view"
880880
>
881881
<div
882882
class="rc-picker-cell-inner customInner"
@@ -1073,7 +1073,7 @@ exports[`Picker.Panel append cell with cellRender in month 1`] = `
10731073
</div>
10741074
</td>
10751075
<td
1076-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
1076+
class="rc-picker-cell rc-picker-cell-in-view"
10771077
title="1990-09"
10781078
>
10791079
<div
@@ -1214,7 +1214,7 @@ exports[`Picker.Panel append cell with cellRender in quarter 1`] = `
12141214
</div>
12151215
</td>
12161216
<td
1217-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
1217+
class="rc-picker-cell rc-picker-cell-in-view"
12181218
title="1990-Q3"
12191219
>
12201220
<div
@@ -4139,7 +4139,7 @@ exports[`Picker.Panel append cell with cellRender in year 1`] = `
41394139
</div>
41404140
</td>
41414141
<td
4142-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
4142+
class="rc-picker-cell rc-picker-cell-in-view"
41434143
title="1990"
41444144
>
41454145
<div
@@ -4363,7 +4363,7 @@ exports[`Picker.Panel monthCellRender 1`] = `
43634363
1990-08
43644364
</td>
43654365
<td
4366-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
4366+
class="rc-picker-cell rc-picker-cell-in-view"
43674367
title="1990-09"
43684368
>
43694369
1990-09
@@ -5060,7 +5060,7 @@ exports[`Picker.Panel override cell with cellRender in decade 1`] = `
50605060
</div>
50615061
</td>
50625062
<td
5063-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
5063+
class="rc-picker-cell rc-picker-cell-in-view"
50645064
>
50655065
<div
50665066
class="customWrapper"
@@ -5217,7 +5217,7 @@ exports[`Picker.Panel override cell with cellRender in month 1`] = `
52175217
</div>
52185218
</td>
52195219
<td
5220-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
5220+
class="rc-picker-cell rc-picker-cell-in-view"
52215221
title="1990-09"
52225222
>
52235223
<div
@@ -5334,7 +5334,7 @@ exports[`Picker.Panel override cell with cellRender in quarter 1`] = `
53345334
</div>
53355335
</td>
53365336
<td
5337-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
5337+
class="rc-picker-cell rc-picker-cell-in-view"
53385338
title="1990-Q3"
53395339
>
53405340
<div
@@ -7503,7 +7503,7 @@ exports[`Picker.Panel override cell with cellRender in year 1`] = `
75037503
</div>
75047504
</td>
75057505
<td
7506-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
7506+
class="rc-picker-cell rc-picker-cell-in-view"
75077507
title="1990"
75087508
>
75097509
<div
@@ -9722,7 +9722,7 @@ exports[`Picker.Panel pass dateRender when picker is month 1`] = `
97229722
</div>
97239723
</td>
97249724
<td
9725-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
9725+
class="rc-picker-cell rc-picker-cell-in-view"
97269726
title="1990-09"
97279727
>
97289728
<div

tests/__snapshots__/range.spec.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ exports[`Picker.Range use dateRender and monthCellRender in month range picker 1
13911391
</div>
13921392
</td>
13931393
<td
1394-
class="rc-picker-cell rc-picker-cell-in-view rc-picker-cell-today"
1394+
class="rc-picker-cell rc-picker-cell-in-view"
13951395
title="1990-09"
13961396
>
13971397
<div>

0 commit comments

Comments
 (0)