Skip to content

Commit 015ac80

Browse files
committed
fix: styling for date time picker and add disabled prop
1 parent 9a3e6d3 commit 015ac80

File tree

2 files changed

+65
-15
lines changed

2 files changed

+65
-15
lines changed

src/Shared/Components/DatePicker/DateTimePicker.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ const DateTimePicker = ({
7171
const isDayBlocked = (day) => isTodayBlocked && !day.isAfter(today)
7272

7373
return (
74-
<div>
74+
<div className="date-time-picker">
7575
<label className={`form__label ${required ? 'dc__required-field' : ''}`} htmlFor={id}>
7676
{label}
7777
</label>
78-
<div className="dc__grid-row-one-half dc__gap-8">
78+
<div className="flex left dc__gap-8">
7979
<SingleDatePicker
80-
id="single_date_picker"
80+
id={id}
8181
placeholder="Select date"
8282
date={moment(dateObject)}
8383
onDateChange={handleDateChange}
@@ -95,6 +95,7 @@ const DateTimePicker = ({
9595
displayFormat={DATE_TIME_FORMATS.DD_MMM_YYYY}
9696
data-testid={dataTestidForDate}
9797
isDayBlocked={isDayBlocked}
98+
disabled={disabled}
9899
/>
99100
{!hideTimeSelect && (
100101
<div className="dc__no-shrink">

src/Shared/Components/DatePicker/datePicker.scss

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,82 @@
1414
* limitations under the License.
1515
*/
1616

17-
.window-configuration {
17+
.date-time-picker {
1818
.DayPicker__horizontal {
1919
position: fixed !important;
2020
}
21-
21+
2222
.SingleDatePickerInput {
2323
display: flex !important;
24-
width: 200px;
24+
width: 100%;
2525
background-color: var(--N50);
2626
margin-right: 0 !important;
2727
padding: 0 !important;
2828
height: 36px !important;
29+
overflow: hidden;
30+
border: 1px solid var(--N200);
31+
border-radius: 4px;
32+
33+
&:hover {
34+
border: 1px solid var(--N400);
35+
}
36+
37+
&:focus,
38+
&:focus-visible,
39+
&:focus-within {
40+
border: 1px solid var(--B500);
41+
}
42+
43+
&__disabled {
44+
background-color: var(--N100);
45+
border-color: var(--N200);
46+
}
2947
}
30-
48+
3149
.SingleDatePickerInput_calendarIcon {
3250
padding: 0 !important;
3351
margin: 0 !important;
3452
padding-right: 8px !important;
35-
background-color: var(--N50) !important;
36-
height: 36px !important;
53+
background-color: transparent !important;
54+
height: 34px !important;
55+
display: flex;
56+
align-items: center;
57+
58+
&:focus-visible {
59+
outline: none;
60+
}
3761
}
38-
39-
.SingleDatePickerInput__withBorder .DateInput {
40-
line-height: 20px !important;
62+
63+
.SingleDatePickerInput__withBorder {
64+
.DateInput {
65+
line-height: 20px !important;
66+
height: 34px;
67+
background-color: transparent;
68+
width: 100%;
69+
}
70+
71+
.DateInput_input {
72+
font-size: 13px;
73+
border-bottom: none;
74+
cursor: pointer;
75+
background-color: transparent;
76+
color: var(--N900);
77+
78+
&__focused+.DateInput_fang {
79+
display: none;
80+
}
81+
82+
&__disabled {
83+
cursor: not-allowed;
84+
}
85+
}
4186
}
42-
87+
4388
.DateInput_input {
44-
padding: 6px 8px !important
89+
padding: 6px 8px !important;
90+
91+
&__disabled {
92+
font-style: normal;
93+
}
4594
}
46-
}
95+
}

0 commit comments

Comments
 (0)