Skip to content

Commit

Permalink
(#0) npm publish (0.0.87)
Browse files Browse the repository at this point in the history
  • Loading branch information
baegofda committed Dec 7, 2023
1 parent 4cf6b38 commit 9b06680
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bbodek-ui",
"version": "0.0.85",
"version": "0.0.87",
"type": "module",
"author": "Bbodek",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,35 @@ const meta = {

export default meta;

export const Default = () => {
const DefaultLayout = () => {
const overlay = useOverlay();

return (
<div className = "flex gap-2">
<div className = "w-[500px]">
<InputDatePicker overlay = {overlay} useTab />
</div>
</div>
);
};

export const Default = () => {
return (
<OverlayProvider>
<div id = "modal"/>
<div className = "flex gap-2">
<div className = "w-[500px]">
<InputDatePicker useTab />
</div>
</div>
<DefaultLayout />
</OverlayProvider>
);
};

const Layout = () => {
const InputDatePickerInModalPopUpLayout = () => {
const overlay = useOverlay();
const inputDatePickerOverlay = useOverlay();
const onOverlay = () => {
overlay.open(({ isOpen }) => {
return (
<ModalPopUp isOpen = {isOpen}>
<InputDatePicker useTab = {false} />
<InputDatePicker overlay = {inputDatePickerOverlay} useTab = {false} />
</ModalPopUp>
);
});
Expand All @@ -45,11 +53,11 @@ const Layout = () => {
);
};

export const ModalDatePicker = () => {
export const InputDatePickerInModalPopUp = () => {
return (
<OverlayProvider>
<div id = "modal"/>
<Layout />
<InputDatePickerInModalPopUpLayout />
</OverlayProvider>
);
};
5 changes: 2 additions & 3 deletions src/core/components/Input/InputDatePicker/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { CalendarBlank } from "@phosphor-icons/react";

import { useOverlay } from "@toss/use-overlay";
import dayjs from "dayjs";
import { useState } from "react";

import { PeriodDates } from "../../Calendar/DatePickerCalendar/types/CalendarComponentProps";
import Typography from "../../Typography";
import DatePicker from "./DatePicker";
import { InputDatePickerProps } from "./types";

const InputDatePicker = ({
overlay,
disabledDates,
currentMonth,
useTab = false,
disabled = false,
}: InputDatePickerProps) => {
const overlay = useOverlay();
const [ periodDates, setPeriodDates ] = useState<PeriodDates>({
startDate: "",
endDate: "",
Expand Down
15 changes: 14 additions & 1 deletion src/core/components/Input/InputDatePicker/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,17 @@ export interface DatePickerProps extends Pick<CalendarComponentProps, "currentMo
close: (periodDates: PeriodDates) => void;
useTab?: boolean;
}
export interface InputDatePickerProps extends Omit<DatePickerProps, "isOpen"| "close"> {}

type CreateOverlayElement = (props: {
isOpen: boolean;
close: () => void;
exit: () => void;
}) => JSX.Element;

export interface InputDatePickerProps extends Omit<DatePickerProps, "isOpen"| "close"> {
overlay: {
open: (overlayElement: CreateOverlayElement) => void;
close: () => void;
exit: () => void;
}
}

0 comments on commit 9b06680

Please sign in to comment.