Skip to content

Commit

Permalink
πŸ› fix: ν”Όλ“œλ°± 반영 #15
Browse files Browse the repository at this point in the history
  • Loading branch information
froggy1014 committed Aug 12, 2024
1 parent 69a8bba commit 3dc46e6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/components/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { FC, useState } from "react";
import { dayjsWithExt } from "@/lib/dayjs";
import { cn } from "@/utils/cn";

import { BasicButton } from "../core/Button";
import IconButton from "../core/Button/IconButton/IconButton";
import { BasicButton, IconButton } from "../core/Button";
import { ArrowLeftSmallIcon, ArrowRightSmallIcon } from "../icons";

interface Props {
Expand All @@ -20,7 +19,7 @@ const Calendar: FC<Props> = ({ onConfirm, startDay, endDay }) => {
startDay ? dayjsWithExt(startDay) : null,
);
const [endDate, setEndDate] = useState<Dayjs | null>(
endDay ? dayjsWithExt(endDay) : null,
endDay && endDay !== startDay ? dayjsWithExt(endDay) : null,
);

const generateCalendar = (date: Dayjs) => {
Expand Down
11 changes: 10 additions & 1 deletion src/components/core/Input/DurationInput/DurationInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ const DurationInput: FC<Props> = ({
const handleConfirm = (startDate: string | null, endDate: string | null) => {
const start = dayjsWithExt(startDate).isValid() ? startDate : null;
const end = dayjsWithExt(endDate).isValid() ? endDate : null;
onConfirm(start, end);

if (!start && end) {
onConfirm(end, end);
}
if (start && !end) {
onConfirm(start, start);
}
if (start && end) {
onConfirm(start, end);
}
setIsOpen(false);
};

Expand Down
3 changes: 3 additions & 0 deletions src/components/core/Input/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export { default as AddressInput } from "./AddressInput/AddressInput";
export { default as DescriptionInput } from "./DescriptionInput/DescriptionInput";
export { default as DurationInput } from "./DurationInput/DurationInput";
export { default as SearchInput } from "./SearchInput/SearchInput";
export { default as TextInput } from "./TextInput/TextInput";

0 comments on commit 3dc46e6

Please sign in to comment.