Skip to content

Commit

Permalink
ADCIO-3282) fix: fix date picker required issue (#45)
Browse files Browse the repository at this point in the history
* fix: fix date picker required issue

* fix: fix datepicker issue

---------

Co-authored-by: dev-redo <[email protected]>
  • Loading branch information
dev-redo and dev-redo committed Apr 19, 2024
1 parent 4969339 commit 8067391
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/DatePicker/DateTime/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function DateTime({
locale={LOCALE[language]}
selected={newDate}
onChange={date => setNewDate(date)}
required={inputProps?.required}
customInput={
<CustomInput
{...inputProps}
Expand Down
1 change: 1 addition & 0 deletions src/components/DatePicker/SingleDate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function SingleDate({
ref={datePickerRef}
locale={LOCALE[language]}
selected={selected}
required={inputProps?.required}
onChange={date => {
onChange(date!);
}}
Expand Down
32 changes: 32 additions & 0 deletions src/stories/DatePicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,38 @@ export function DateTime() {
);
}

export function InputStyle() {
const [singleDate, setSingleDate] = useState<Date | null>(null);
const [dateTime, setDateTime] = useState<Date | null>(null);

return (
<Container>
<DatePicker.Date
selected={singleDate}
onChange={setSingleDate}
language={'ko'}
inputProps={{
width: 400,
label: 'Single Date',
required: true,
description: '날짜만 입력할 수 있는 입력창 입니다.',
}}
/>
<DatePicker.DateTime
selected={dateTime}
onChange={setDateTime}
language={'ko'}
inputProps={{
width: 400,
label: 'Date Time',
required: true,
description: '날짜와 시간을 모두 입력할 수 있는 입력창 입니다.',
}}
/>
</Container>
);
}

const Container = styled.div`
width: 100%;
height: 100%;
Expand Down

0 comments on commit 8067391

Please sign in to comment.