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

Date range default value #1988

Open
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

Franreno
Copy link

@Franreno Franreno commented May 8, 2024

Description

This PR aims to add a defaultValue parameter to the DateRange input component.
The defaultValue has the purpose to define a default range when the component is first loaded.

To use is to simply add the defaultValue as below:

<DateRange 
    data={orders_by_month} 
    dates=month 
    name=range_default 
    defaultValue="Last 90 days"
/>

Then, the DateRange will initialize with the defaultValue provided

Screenshot 2024-05-08 at 19 14 02

If the parameter is not provided or does not comply with the labels available on the preset variable, then the component's behavior should be the same as previously

Screenshot 2024-05-08 at 19 13 52

Closes #1984

Checklist

  • For UI or styling changes, I have added a screenshot or gif showing before & after
  • I have added a changeset
  • I have added to the docs where applicable
  • I have added to the VS Code extension where applicable

Copy link

changeset-bot bot commented May 8, 2024

🦋 Changeset detected

Latest commit: 7c65500

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@evidence-dev/core-components Patch
@evidence-dev/components Patch
@evidence-dev/evidence Patch
my-evidence-project Patch
evidence-test-environment Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

netlify bot commented May 8, 2024

Deploy Preview for evidence-development-workspace ready!

Name Link
🔨 Latest commit 7c65500
🔍 Latest deploy log https://app.netlify.com/sites/evidence-development-workspace/deploys/66465ac9e1e1330008d1d70b
😎 Deploy Preview https://deploy-preview-1988--evidence-development-workspace.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.

Copy link

netlify bot commented May 8, 2024

Deploy Preview for evidence-test-env ready!

Name Link
🔨 Latest commit 7c65500
🔍 Latest deploy log https://app.netlify.com/sites/evidence-test-env/deploys/66465ac99e56d700082314da
😎 Deploy Preview https://deploy-preview-1988--evidence-test-env.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.

Copy link

netlify bot commented May 8, 2024

Deploy Preview for next-docs-evidence ready!

Name Link
🔨 Latest commit 7c65500
🔍 Latest deploy log https://app.netlify.com/sites/next-docs-evidence/deploys/66465ac9a01ee80008675ada
😎 Deploy Preview https://deploy-preview-1988--next-docs-evidence.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.

@Franreno Franreno marked this pull request as ready for review May 8, 2024 18:27
@ItsMeBrianD ItsMeBrianD self-requested a review May 16, 2024 14:59
Copy link
Member

@mcrascal mcrascal left a comment

Choose a reason for hiding this comment

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

This is awesome, I like this string based API for selecting default date ranges.

The only thing that seems off to me here is the loading behaviour. It seems that in the process of loading, results from queries that depend on the value here transition through an empty state, causing a no data error to be briefly visible in dependent components. @ItsMeBrianD can probably help identify the issue.

CleanShot 2024-05-17 at 10 56 17

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.

Default date range for DateRange input
3 participants