Skip to content

Commit

Permalink
Merge pull request #5 from Principes-Artis-Mechanicae/feature/DatePicker
Browse files Browse the repository at this point in the history
Feature: DatePicker 컴포넌트 구현
  • Loading branch information
toothlessdev authored Aug 26, 2024
2 parents 12da0de + e1334f7 commit bd2d259
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/components/form/DatePicker.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import styled from "@emotion/styled";
import { DatePickerProps } from "./DatePicker";

export const DatePickerElement = styled.input<DatePickerProps>`
display: block;
width: ${(props) => props.width};
height: ${(props) => props.height};
border: 0;
border-bottom: 1px solid #c4c7cc;
font-size: 16px;
&:focus {
outline: none;
}
&::-webkit-calendar-picker-indicator {
height: 100%;
aspect-ratio: 1/1;
}
`;
11 changes: 11 additions & 0 deletions packages/components/form/DatePicker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { forwardRef } from "react";
import { DatePickerElement } from "./DatePicker.style";

export interface DatePickerProps extends React.ComponentProps<"input"> {
width: string;
height: string;
}

export const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(({ width, height }, ref) => {
return <DatePickerElement ref={ref} type="date" width={width} height={height}></DatePickerElement>;
});
1 change: 1 addition & 0 deletions packages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export { SearchBar } from "./components/form/SearchBar";
export { TextArea } from "./components/form/TextArea";
export { RadioGroup, RadioItem } from "./components/form/Radio";
export { DropDown, DropDownItem } from "./components/form/DropDown";
export { DatePicker } from "./components/form/DatePicker";

// helper
export { withProviders } from "./components/helper/withProviders";
Expand Down
17 changes: 17 additions & 0 deletions packages/stories/DatePicker.story.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Meta, StoryObj } from "@storybook/react";
import { DatePicker } from "../components/form/DatePicker";

const meta = {
title: "Form/DatePicker",
component: DatePicker,
} satisfies Meta<typeof DatePicker>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
width: "440px",
height: "54px",
},
};

0 comments on commit bd2d259

Please sign in to comment.