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

DateRange: make onCancel and onSubmit events optional (web) #3812

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CarlosAvina
Copy link
Contributor

@CarlosAvina CarlosAvina commented Oct 18, 2024

Summary

Makes onCancel and onSubmit events optional props. This will also hide cancel and submit buttons.

What changed?

Makes onCancel and onSubmit events optional props. If those props are not passed then the component is going to hide the cancel and submit buttons.

Why?

The current DatePicker used in analytics doesn't have an apply button, the user is accustomed to an action to occur when the endDate is selected, the data fetching occurs currently on the endDateChange event. There is no onCancel or onSubmit business logic on our side. For accomplish this we don't need to change the logic of the component, we just need to conditionally render those buttons if the props are present.

Screenshots

Screenshot 2024-10-18 at 2 12 38 p m Screenshot 2024-10-18 at 2 12 26 p m

Links

  • Jira
  • [TDD](link to Paper doc)
  • [Figma](link to Figma file)

Checklist

  • Added unit tests
  • Added documentation + accessibility tests
  • Verified accessibility: keyboard & screen reader interaction
  • Checked dark mode, responsiveness, and right-to-left support
  • Checked stakeholder feedback (e.g. Gestalt designers, relevant feature teams)

Copy link

netlify bot commented Oct 18, 2024

Deploy Preview for gestalt ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 3607b5a
🔍 Latest deploy log https://app.netlify.com/sites/gestalt/deploys/6712d603dbc6e8000845be20
😎 Deploy Preview https://deploy-preview-3812--gestalt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AlbertCarreras AlbertCarreras added the minor release Minor release label Oct 21, 2024
@AlbertCarreras
Copy link
Contributor

AlbertCarreras commented Oct 21, 2024

https://gestalt.pinterest.systems/web/daterange#Controlled-component

on this example, can you fix the on dismiss? and add setShowComponent(false)?
thasnk! it was innacessible that way

Screenshot by Dropbox Capture

Can you also update the docs?

DateRange is a controlled component.
Use dateValue, onDateChange, onDateError, onSubmit and onCancel to implement it correctly.

Follow the implementation in the example to implement a controlled DateRange correctly.

When there’s not a date range selected, the call-to-action is disabled to prevent user errors.

'onSubmit' and 'onCancel' are optional props. When not used, make sure DateRange is accessible implementing Popover's onDismiss correctly, as shown in the example. Otherwise, DateRange might not be able to be dismissed if the user performs no changes in the data.

@AlbertCarreras AlbertCarreras marked this pull request as ready for review October 21, 2024 18:36
@AlbertCarreras AlbertCarreras requested a review from a team as a code owner October 21, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor release Minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants