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 and duration components to work in jinja2 environments #3080

Merged
merged 33 commits into from
Mar 14, 2024

Conversation

rmccar
Copy link
Contributor

@rmccar rmccar commented Mar 11, 2024

What is the context of this PR?

Fixes: #3081

Recently the duration and date components were refactored to move any duplication of logic into a single shared macro. This was done using the .push method which is used in nunjucks to push the fields used in the macros into an array which was then used in the shared macro. The .push method is not compatible with jinja2 and is causing errors when using the components. This has needed another refactor to make sure it is working in jinja2 environments. So I have moved the use of the input component back into the individual date and duration marcos themselves to remove the need to use .push.

As part of this I have also standardised the params and tests that are used across the two components.

How to review this PR

Test components still work as expected after the refactor and the changes make sense.

Checklist

This needs to be completed by the person raising the PR.

  • I have selected the correct Assignee
  • I have linked the correct Issue

@rmccar rmccar self-assigned this Mar 11, 2024
@rmccar rmccar added the Bug Something isn't working label Mar 11, 2024
Copy link

netlify bot commented Mar 11, 2024

Deploy Preview for ons-design-system-preview ready!

Name Link
🔨 Latest commit ba7a3cb
🔍 Latest deploy log https://app.netlify.com/sites/ons-design-system-preview/deploys/65f1da05d2a1b800086d8ba1
😎 Deploy Preview https://deploy-preview-3080--ons-design-system-preview.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.

@rmccar rmccar changed the title formatting Refactor date and duration components to work in jinja2 environments Mar 11, 2024
@rmccar rmccar marked this pull request as ready for review March 11, 2024 15:46
@rmccar rmccar requested a review from a team March 11, 2024 15:47
@rmccar rmccar force-pushed the fix-date-duration-inputs-in-jinja branch from 2d178a8 to 650d2bc Compare March 13, 2024 09:56
@rmccar rmccar merged commit dafec94 into main Mar 14, 2024
9 checks passed
@rmccar rmccar deleted the fix-date-duration-inputs-in-jinja branch March 14, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date and duration components erroring when being used in jinja2 environments
4 participants