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

#SHA-26 - feat: add-smart-datetime-input #40

Merged
merged 14 commits into from
Apr 9, 2024

Conversation

gaurangrshah
Copy link
Collaborator

@gaurangrshah gaurangrshah commented Apr 9, 2024

https://linear.app/shadcn-extension/issue/SHA-31/smart-datetime-input

This is a smart datetime input component that handles natural language processing to pick and set accurate dates. This component was heavily inspired by: @steventey and @dub.co
Kapture 2024-04-09 at 02 25 27

This component relies on the shadcn-ui/input component. And a node based lightweight date parsing library: chrono-node

NOTE: there is also a small accessibility concern still outstanding. The issue has to do with the tab order and how this component is actually composed. It actually uses two inputs both wired to the same state. One for the natural language processing and the other is a standard html date and time input of which we only show the icon. Although the 2nd input is mostly hidden the individual values in the input (d/m/y : hour/min/sec) are all still accepting individual tab input via the tab order.

Will need to override the natural html tab order to provide a seamless accessibility experience.


Update

I was able to address both issues it was pretty simple to add the icon as per @BelkacemYerfa's instructions, simply defining a new icon in icons.tsx and giving it a key of what ever the domain name in the link is helps map the link to the icon pretty well from the primitive-link.tsx component.

As for the tab order issue, that was a bit more of a trade-off. The original design from the reference source. Which placed the native html datetime input second in the tab order which meant it felt unintuitive when the tab-order skipped that button. Simple fix without having to do too much of a back was to simply switch the input taborder physically. This put the icon before the input making the tab accessibility feel more natural.

image

@gaurangrshah gaurangrshah changed the title feat: add-smart-datetime-input #SHA-26 - feat: add-smart-datetime-input Apr 9, 2024
@gaurangrshah gaurangrshah marked this pull request as ready for review April 9, 2024 15:30
@BelkacemYerfa BelkacemYerfa merged commit 4f77975 into BelkacemYerfa:dev Apr 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants