diff --git a/package.json b/package.json index d4f6af9..9f5958a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bbodek-ui", - "version": "0.0.88", + "version": "0.0.89", "type": "module", "author": "Bbodek", "license": "MIT", diff --git a/src/core/components/Calendar/DatePickerCalendar/subs/CalendarComponentDayText.tsx b/src/core/components/Calendar/DatePickerCalendar/subs/CalendarComponentDayText.tsx index f7350f3..4ab08f6 100644 --- a/src/core/components/Calendar/DatePickerCalendar/subs/CalendarComponentDayText.tsx +++ b/src/core/components/Calendar/DatePickerCalendar/subs/CalendarComponentDayText.tsx @@ -1,4 +1,5 @@ import clsx from "clsx"; + import { CalendarDateDto } from "@/core/components/Calendar/common/types/CalendarDateDto"; import { PeriodDates } from "../types/CalendarComponentProps"; @@ -20,7 +21,6 @@ export const CalendarComponentDayText = ({ const isStartDate = isPeriod && periodDates.startDate === currentDate; const isEndDate = isPeriod && periodDates.endDate === currentDate; const singleSelectedDate = (periodDates.startDate && !periodDates.endDate) && currentDate === periodDates.startDate; - console.log(isStartDate); return (
{ const id = useId(); @@ -23,6 +24,7 @@ const DatePicker = ({ startDate: "", endDate: "", }); + const [ tabSelected, setTabSelected ] = useState("selectedDate"); const tabData = [ { key: "selectedDate", label: "선택한 기간만 적용" }, @@ -33,6 +35,10 @@ const DatePicker = ({ close(periodDates); }; + useEffect(() => { + externalDates && setPeriodDates(externalDates); + }, [externalDates]); + const tabItems = tabData.map(item => ( { const overlay = useOverlay(); + const [ myDates, setMyDates ] = useState({ + startDate: "", + endDate: "", + }); const getDate = (periodDates: PeriodDates) => console.log(periodDates); + const onDatesClick = () => setMyDates({ startDate: "22222", endDate: "1111" }); + return (
- + +
); @@ -46,7 +54,7 @@ const InputDatePickerInModalPopUpLayout = () => { overlay.open(({ isOpen }) => { return ( - + ); }); diff --git a/src/core/components/Input/InputDatePicker/index.tsx b/src/core/components/Input/InputDatePicker/index.tsx index 8c32938..3203459 100644 --- a/src/core/components/Input/InputDatePicker/index.tsx +++ b/src/core/components/Input/InputDatePicker/index.tsx @@ -1,6 +1,6 @@ import { CalendarBlank } from "@phosphor-icons/react"; import dayjs from "dayjs"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { PeriodDates } from "../../Calendar/DatePickerCalendar/types/CalendarComponentProps"; import Typography from "../../Typography"; @@ -12,6 +12,7 @@ const InputDatePicker = ({ disabledDates, getPeriodDates, currentMonth, + externalDates, useTab = false, disabled = false, }: InputDatePickerProps) => { @@ -34,6 +35,7 @@ const InputDatePicker = ({ getPeriodDates(periodDates); close(); }} + externalDates = {periodDates} useTab = {useTab} disabledDates = {disabledDates}/> )); @@ -46,6 +48,10 @@ const InputDatePicker = ({ setPeriodDates(periodDates); }; + useEffect(() => { + externalDates && setPeriodDates(externalDates); + }, [externalDates]); + return (