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

Refactor date picker to make components reusable for date range picker #65025

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

kangzj
Copy link

@kangzj kangzj commented Sep 4, 2024

What?

The PR refactors Calendar and Day to separate components, so that they could be used in the to-be-created Date Range picker. The prototype could be found here.

Why?

Create a Date Range picker as a Core component.

How?

Extracted Day and Calendar to separate component, and re-arranged event handlers.

Testing Instructions

  • Ensure all tests pass
  • Open storybook and find DatePicker
  • Ensure all the examples still work okay
  • Ensure the code looks okay

Testing Instructions for Keyboard

Screenshots or screencast

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Sep 4, 2024
Copy link

github-actions bot commented Sep 4, 2024

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @kangzj! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@kangzj kangzj marked this pull request as ready for review September 4, 2024 03:31
@kangzj kangzj requested a review from ajitbohra as a code owner September 4, 2024 03:31
Copy link

github-actions bot commented Sep 4, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: kangzj <[email protected]>
Co-authored-by: mirka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@tyxla tyxla added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Sep 4, 2024
@tyxla tyxla requested a review from a team September 4, 2024 07:05
@mirka
Copy link
Member

mirka commented Sep 4, 2024

Hi, thank you for contributing 👋 Linking to the main issue so we can track related progress: #60971

Before we make code changes, do we have alignment with @WordPress/gutenberg-design on what we're aiming for? To start, your prototype already deviates from an initial design that was proposed, which was two DatePickers linked together (yours seems to be done with a single DatePicker). Furthermore, we are starting to consider even leveraging <input type="datetime-local"> for its various benefits (#64390).

@kangzj
Copy link
Author

kangzj commented Sep 4, 2024

Thanks for the feedback @mirka.

Before we make code changes, do we have alignment with @WordPress/gutenberg-design on what we're aiming for?

Sorry I'm not aware of the process. We are aiming for part of the design in #60971. To be specific, our scope for the project is only the date range picker, without any of the inputs, shortcuts or apply/cancel buttons, just like the following.

image

To start, your prototype already deviates from an initial design that was proposed, which was two DatePickers linked together (yours seems to be done with a single DatePicker)

Like mentioned above, we are committed to create the date range picker. The prototype is only a start, and no design has been applied yet. I'm working towards implementing the functionality first and applying the design after. This will be an incremental process. Also I don't want the prototype to grow any bigger before I start merging to Gutenberg since we can mark components WIP. However, if the team prefers it finished and merged as a whole, I would be happy as well.

Furthermore, we are starting to consider even leveraging for its various benefits (#64390).

This is one of the reasons I wanted to share my approach earlier rather than later. I shared in slack as well - this is the approach we think that doesn't satisfy our needs, meaning we don't think it's the easiest way to picker a date range.

Please let me know if I should pause the work till the agreement is reached; otherwise I'll move forward. Thanks all.

@keoshi @ederrengifo @emaurer11 @tyxla @jameskoster @oskosk

@kangzj kangzj marked this pull request as draft September 4, 2024 22:07
@kangzj kangzj marked this pull request as ready for review September 4, 2024 23:01
@kangzj
Copy link
Author

kangzj commented Sep 5, 2024

I spent some time today to make the prototype look more like the design, but still a WIP:

Screen.Recording.2024-09-05.at.4.30.27.PM.mov

@mirka
Copy link
Member

mirka commented Sep 5, 2024

Like mentioned above, we are committed to create the date range picker. The prototype is only a start, and no design has been applied yet. I'm working towards implementing the functionality first and applying the design after. This will be an incremental process.

That's totally fine, and once we do reach agreement on the high-level design, it's not unlikely that the dev work will start with some refactoring work like you are doing here and then continue as an iterative process.

For highest efficiency, I believe the process here will need to be:

  1. Align with @WordPress/gutenberg-core on design specs.
  2. Align with @WordPress/gutenberg-components on overall API/modularity design.
  3. Iterative dev work (thank you again for contributing on this front 🙏)

After step 1 is complete, we'd also appreciate your participation in step 2 to make sure we're covering all the necessary use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants