Skip to content

Commit 946476f

Browse files
committed
Remove unused icon, and found that nothing is working...
1 parent b42d459 commit 946476f

File tree

2 files changed

+41
-34
lines changed

2 files changed

+41
-34
lines changed

src/components/Time.tsx

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@ import React, { ChangeEvent, useCallback, useContext } from "react";
22

33
import { RING_COLOR } from "../constants";
44
import DatepickerContext from "../contexts/DatepickerContext";
5-
import { classNames as cn } from "../helpers";
6-
7-
import { DoubleVerticalChevronRightIcon } from "./utils";
5+
import { classNames as cn, formatDateTimeToISO } from "../helpers";
86

97
import { PeriodDay } from "types";
108

119
const Time: React.FC = () => {
1210
// Contexts
13-
const { primaryColor, changeHour, changeMinute, changePeriodDay } =
14-
useContext(DatepickerContext);
11+
const {
12+
hour,
13+
minute,
14+
periodDay,
15+
period,
16+
primaryColor,
17+
changeDatepickerValue,
18+
changeHour,
19+
changeMinute,
20+
changePeriodDay
21+
} = useContext(DatepickerContext);
1522

1623
const ringFocusColor = RING_COLOR.focus[primaryColor as keyof typeof RING_COLOR.focus];
1724

@@ -35,13 +42,39 @@ const Time: React.FC = () => {
3542
const HOURS = Array.from({ length: 12 });
3643
const MINUTES = Array.from({ length: 12 });
3744

38-
const handleChangeHour = (e: ChangeEvent<HTMLSelectElement>) => changeHour(e.target.value);
45+
const handleChangeHour = (e: ChangeEvent<HTMLSelectElement>) => {
46+
changeHour(e.target.value);
47+
48+
if (period.start && period.end) {
49+
changeDatepickerValue({
50+
startDate: formatDateTimeToISO(period.start, e.target.value, minute, periodDay),
51+
endDate: formatDateTimeToISO(period.end, e.target.value, minute, periodDay)
52+
});
53+
}
54+
};
3955

40-
const handleChangeMinute = (e: ChangeEvent<HTMLSelectElement>) => changeMinute(e.target.value);
56+
const handleChangeMinute = (e: ChangeEvent<HTMLSelectElement>) => {
57+
changeMinute(e.target.value);
4158

42-
const handleChangePeriodDay = (e: ChangeEvent<HTMLSelectElement>) =>
59+
if (period.start && period.end) {
60+
changeDatepickerValue({
61+
startDate: formatDateTimeToISO(period.start, hour, e.target.value, periodDay),
62+
endDate: formatDateTimeToISO(period.end, hour, e.target.value, periodDay)
63+
});
64+
}
65+
};
66+
67+
const handleChangePeriodDay = (e: ChangeEvent<HTMLSelectElement>) => {
4368
changePeriodDay(e.target.value as PeriodDay);
4469

70+
if (period.start && period.end) {
71+
changeDatepickerValue({
72+
startDate: formatDateTimeToISO(period.start, hour, minute, e.target.value),
73+
endDate: formatDateTimeToISO(period.end, hour, minute, e.target.value)
74+
});
75+
}
76+
};
77+
4578
return (
4679
<div className="w-full md:w-auto flex items-center justify-center space-x-3">
4780
<div className="pb-6">

src/components/utils.tsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -118,32 +118,6 @@ export const DoubleChevronRightIcon: React.FC<IconProps> = ({ className = "w-6 h
118118
);
119119
};
120120

121-
export const DoubleVerticalChevronRightIcon: React.FC<IconProps> = ({ className = "w-6 h-6" }) => {
122-
return (
123-
<svg
124-
className={className}
125-
xmlns="http://www.w3.org/2000/svg"
126-
width="16"
127-
height="16"
128-
viewBox="0 0 16 16"
129-
fill="none"
130-
>
131-
<path
132-
fill-rule="evenodd"
133-
clip-rule="evenodd"
134-
d="M8.35355 4.06066C8.15829 3.8654 7.84171 3.8654 7.64645 4.06066L5.35355 6.35355C5.15829 6.54882 4.84171 6.54882 4.64645 6.35355C4.45118 6.15829 4.45118 5.84171 4.64645 5.64645L6.93934 3.35356C7.52513 2.76777 8.47487 2.76777 9.06066 3.35355L11.3536 5.64645C11.5488 5.84171 11.5488 6.15829 11.3536 6.35355C11.1583 6.54882 10.8417 6.54882 10.6464 6.35355L8.35355 4.06066Z"
135-
fill="#6b7280"
136-
/>
137-
<path
138-
fill-rule="evenodd"
139-
clip-rule="evenodd"
140-
d="M8.35355 11.9393C8.15829 12.1346 7.84171 12.1346 7.64645 11.9393L5.35355 9.64645C5.15829 9.45119 4.84171 9.45119 4.64645 9.64645C4.45118 9.84171 4.45118 10.1583 4.64645 10.3536L6.93934 12.6464C7.52513 13.2322 8.47487 13.2322 9.06066 12.6464L11.3536 10.3536C11.5488 10.1583 11.5488 9.84171 11.3536 9.64645C11.1583 9.45119 10.8417 9.45119 10.6464 9.64645L8.35355 11.9393Z"
141-
fill="#6b7280"
142-
/>
143-
</svg>
144-
);
145-
};
146-
147121
// eslint-disable-next-line react/display-name,@typescript-eslint/ban-types
148122
export const Arrow = React.forwardRef<HTMLDivElement, {}>((props, ref) => {
149123
return (

0 commit comments

Comments
 (0)