Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support editable input | min & max dates | dd-mm-yyyy format in CalendarInput #1504

Merged
Merged
Prev Previous commit
Next Next commit
chore: add story CalendarWithEditiableInput
alaa-yahia committed Jun 10, 2024
commit 14f8bde6274efb84d5a3639a3c324d8247dc2152
50 changes: 36 additions & 14 deletions components/calendar/src/stories/calendar-input.stories.js
Original file line number Diff line number Diff line change
@@ -22,20 +22,17 @@ export default {
},
}

const buildCalendar =
({ date, locale, calendar }) =>
() =>
(
<CalendarStoryWrapper
component={CalendarInput}
dir="ltr"
timeZone="Africa/Khartoum"
weekDayFormat="short"
date={date}
locale={locale}
calendar={calendar}
/>
)
const buildCalendar = ({ date, locale, calendar }) => () => (
<CalendarStoryWrapper
component={CalendarInput}
dir="ltr"
timeZone="Africa/Khartoum"
weekDayFormat="short"
date={date}
locale={locale}
calendar={calendar}
/>
)

export const EthiopicWithAmharic = buildCalendar({
calendar: 'ethiopic',
@@ -114,3 +111,28 @@ export const CalendarWithClearButton = ({
</>
)
}

export function CalendarWithEditiableInput() {
const [date, setDate] = useState('2020-07-03')
return (
<div>
<>
<CalendarInput
editable
date={date}
calendar="gregory"
onDateSelect={(selectedDate) => {
const date = selectedDate?.calendarDateString
setDate(date)
}}
label="ooo"
width={'700px'}
inputWidth="900px"
timeZone={'UTC'}
minDate={'2020-07-01'}
maxDate={'2020-07-09'}
/>
</>
</div>
)
}