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

docs: DatePicker API #2138

Merged
merged 11 commits into from
May 27, 2024
Merged

docs: DatePicker API #2138

merged 11 commits into from
May 27, 2024

Conversation

anuraghazra
Copy link
Member

@anuraghazra anuraghazra commented Apr 23, 2024

Copy link

changeset-bot bot commented Apr 23, 2024

⚠️ No Changeset found

Latest commit: 8473a48

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Apr 23, 2024

✅ PR title follows Conventional Commits specification.

Copy link

codesandbox-ci bot commented Apr 23, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8473a48:

Sandbox Source
razorpay/blade: basic Configuration

@rzpcibot
Copy link
Collaborator

rzpcibot commented Apr 23, 2024

Bundle Size Report

No bundle size changes detected.

Generated by 🚫 dangerJS against 8473a48

@anuraghazra anuraghazra added the Review - L1 First level of review label Apr 30, 2024
* Sets the picker type
* @default 'date'
*/
picker: PickerType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pickerType?

## Basic Usage

```jsx
<DatePickerInput
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add controlled example?


## Open Questions

- How should we approach locale?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good what you've proposed

## Open Questions

- How should we approach locale?
- What should we do about the triggers? will be have buttons/inputs both?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can discuss this once design is done with triggers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will only have inputs

snitin315
snitin315 previously approved these changes Apr 30, 2024

The Date Picker component lets users select a date from a calendar. It is used to input a date or range of dates.

<img src="./datepicker-thumbnail.png" width="380" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing thumbnail

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, missing from design side


## Anatomy

<img src="./datepicker-anatomy.png" width="100%" alt="DatePicker Anatomy" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing image


## Design

[Figma Link]() to all variants of the DatePicker component
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing link

*/
locale: string;

// Basic selection props
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will these callbacks work? Won't some of them overlap? For example when you change the month it will trigger - onMonthChange, onNext, onNextMonth (in edge cases it may also trigger onYearChange, onNextYear?)

Can we not just keep onChange and let users compute what has been changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not going to provide onMonthChange/onYearChange.

Only:

onNext: (date: Date) => void;
onNextMonth: (date: Date) => void;
onNextYear: (date: Date) => void;
onNextDecade: (date: Date) => void;
onPrevious: (date: Date) => void;
onPreviousYear: (date: Date) => void;
onPreviousMonth: (date: Date) => void;
onPreviousDecade: (date: Date) => void;

Can we not just keep onChange and let users compute what has been changed?

That will not be a very DX friendly way to provide event handling information.

Plus our OnChange only triggers when you click on "Apply" button it doesn't trigger if you click the Chevrons.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the use cases of these?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly analytics and controlled state management.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: we decided to remove the redundant onNextYear,onNextDecade,onNextMonth etc props in favour of 1 onNext prop.

onNext?: (args: { date: Date; type: "month" | "year" | "decade" }) => void;

packages/blade/src/components/Popover/Popover.web.tsx Outdated Show resolved Hide resolved
- What should we do about the triggers? will be have buttons/inputs both?
- We will only have inputs as triggers

## Integration with i18nify
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets raise this with the i18nify team and figure out what can we do?


<img src="./datepicker-anatomy.png" width="100%" alt="DatePicker Anatomy" />

## Components
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this assumption correct:

  • Calendar is an independent component that doesn't need a trigger
  • DatePicker is a component that comes with a trigger upon clicking which a calendar is popped up

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Tho we will not expose the Calendar component.

@anuraghazra anuraghazra marked this pull request as ready for review May 14, 2024 10:48
@anuraghazra anuraghazra merged commit 09a76ba into master May 27, 2024
14 checks passed
@anuraghazra anuraghazra deleted the anu/datepicker-api branch May 27, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review - L1 First level of review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants