-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add wildcard/calendar component based on 'react-calendar' npm package #40679
Conversation
Codenotify: Notifying subscribers in OWNERS files for diff 7d48b11...ca54aea.
|
ef9b45d
to
2080f71
Compare
…; Fix TypeScript errors
Hey @erzhtor! Thank you for just getting in there and putting this together 😎. As for adding the component to Wildcard (or not), these are the options @sourcegraph/frontend-platform team would be fine with: Option 1: Since this component is brand new to the codebase (versus moving an existing component with a history of use to Wildcard), it can start in Wildcard if it gets annotated via JSDoc comments that include:
Option 2: Skip adding to Wildcard for now and include it directly in the user-management page folder, as you mentioned in your original comment. For either of these options, we can consider the Calendar component when we get to planning Wildcard v3 later this year (whether that's moving the component out of an experimental state and committing to support it, or moving it into Wildcard if you opt not to add it there now). |
|
||
export default config | ||
|
||
// NOTE: hardcoded in order to screenshot test the calendar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor accessibility issue: the contrast of the highlighted today's date is not spec compliant and hard to read when selected in the dark mode.
Tested using the deployed version of the Storybook.
My vote here goes for the first option: add the experimental label and any other context required to the component usage (basic docs) and add it to the Wildcard. Thanks for tagging us here and for the intent to help other teams with this component! 🙌
Thanks, @valerybugakov, @lrhacker for the input and reviews! I've addressed comments and added jsDocs. Also added messaging to mention the "experimental" state of the component to both jsDocs as well as on storybook stories (to make it explicit to other devs). |
a3c0e9c
to
ca54aea
Compare
@erzhtor why do we need a custom calendar picker component? (In general I have nothing against custom pickers, but just try to play a devil's advocate here)
Maybe we could push back on designs about the site admin pages where we have to have this custom date picker in order to avoid these possible problems that I list above. |
Hey, @vovakulikov. Thanks for bringing up your concerns. All of the above said, I think is valid. However, for "site-admin / user administration," we have to make a custom date range picker with additional custom logic: However, I don't think we should be changing the current date range selected in "user administration" to native date inputs because:
|
Part 1 of #40593.
For the new user-management page, we need to add column filters, and some columns are of date type. This PR adds a Calendar component based on
react-calendar
, with basic Sourcegraph styles (light/dark mode) that supports date or date range selection.@sourcegraph/frontend-platform, @rrhyne I thought that this base Calendar could be useful to extract into wildcard in case there will be some other places where a calendar or date range picker will be needed. However, if you think this should not be included in the wildcard yet, I can close this PR and just include it directly in the user-management page folder.
Test plan
yarn storybook:wildcard
Screenshots
<Calendar value={value as [Date, Date]} onChange={onChange} />
<Calendar mode="range" value={value as [Date, Date]} onChange={onChange} />
App preview:
Check out the client app preview documentation to learn more.