Skip to content

Commit 07e1e19

Browse files
committed
fix: date picker select year and custom time style
1 parent 96b8c38 commit 07e1e19

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

src/components/v5/common/ActionSidebar/partials/TimeRow/TimeRow.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import { StreamingPaymentEndCondition } from '~gql';
1313
import Tooltip from '~shared/Extensions/Tooltip/Tooltip.tsx';
1414
import { formatText } from '~utils/intl.ts';
1515
import ActionFormRow from '~v5/common/ActionFormRow/index.ts';
16-
17-
import useHasNoDecisionMethods from '../../hooks/permissions/useHasNoDecisionMethods.ts';
16+
import useHasNoDecisionMethods from '~v5/common/ActionSidebar/hooks/permissions/useHasNoDecisionMethods.ts';
1817

1918
import { END_OPTIONS, START_OPTIONS } from './consts.ts';
2019
import { CUSTOM_DATE_VALUE } from './partials/TimeRowField/consts.ts';

src/components/v5/common/ActionSidebar/partials/TimeRow/partials/TimeRowField/TimeRowField.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import clsx from 'clsx';
2+
import { addYears, subYears } from 'date-fns';
23
import format from 'date-fns/format';
34
import isDate from 'date-fns/isDate';
45
import React, { useState, type FC } from 'react';
@@ -36,6 +37,9 @@ const TimeRowField: FC<TimeRowFieldProps> = ({
3637
isDate(field.value) ? customDateValue : field.value,
3738
);
3839

40+
const year15YearsAgo = subYears(new Date(), 15).getFullYear();
41+
const year15YearsAhead = addYears(new Date(), 15).getFullYear();
42+
3943
return (
4044
<CardSelect<string>
4145
options={options}
@@ -97,6 +101,8 @@ const TimeRowField: FC<TimeRowFieldProps> = ({
97101
inline
98102
onClose={onClick}
99103
minDate={minDate}
104+
minYear={year15YearsAgo}
105+
maxYear={year15YearsAhead}
100106
/>
101107
</div>
102108
)}

src/styles/main.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ body.ReactModal__Body--open:not(.show-header-in-modal) .modal-blur-navigation {
6161
@apply blur-[0.125rem];
6262
}
6363

64+
ul.react-datepicker__time-list {
65+
@apply bg-base-white;
66+
}
67+
68+
li.react-datepicker__time-list-item {
69+
@apply hover:bg-gray-50 !important;
70+
}
71+
6472
:root {
6573
--onboard-connect-sidebar-background: var(--color-gray-200);
6674
--onboard-main-scroll-container-background: var(--color-base-white);

tailwind.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ module.exports = {
133133
content: '0px 1px 2px rgba(16, 24, 40, 0.05)',
134134
overlay: 'blur(2px)',
135135
'light-blue': '0px 0px 3px 3px rgba(239, 248, 255, 1)',
136-
'select': '0px 1px 2px 0px rgba(16, 24, 40, 0.05);'
136+
select: '0px 1px 2px 0px rgba(16, 24, 40, 0.05);',
137137
},
138138
transitionDuration: {
139139
slow: '450ms',
@@ -158,7 +158,7 @@ module.exports = {
158158
},
159159
spacing: {
160160
4.5: '1.125rem',
161-
8.5: '2.125rem'
161+
8.5: '2.125rem',
162162
},
163163
},
164164
},
@@ -307,6 +307,12 @@ module.exports = {
307307
'.divider': {
308308
'@apply w-full border border-gray-200': {},
309309
},
310+
'ul.react-datepicker__time-list': {
311+
'@apply bg-base-white': {},
312+
},
313+
'li.react-datepicker__time-list-item': {
314+
'@apply hover:bg-gray-50 !important': {},
315+
},
310316
});
311317
},
312318
],

0 commit comments

Comments
 (0)