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

Add Date and DateTime Pickers #1126

Merged
merged 2 commits into from
Jun 5, 2023
Merged

Conversation

aidanjrauscher
Copy link
Contributor

Add Date and DateTime Pickers

This PR implements a datepicker and datetimepicker component by inheriting the Input component and using the appropriate type attributes.

I opted to use base html for these components as I felt the available React and Chakra libraries introduced unnecessary complexity, and the default styling for the datepicker and datetimepicker elements looks decent out of the box.

Note: given these components are implemented as inputs, their value will be a string.

closes #237

P.S. Would love to be considered for the Software Engineering Intern role (if still open) ;)


All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] This change requires a documentation update

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

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

Not sure why these would need to be separate components when the same effect can be achieved by passing pc.input(..., type_="datetime-local")

@aidanjrauscher
Copy link
Contributor Author

Not sure why these would need to be separate components when the same effect can be achieved by passing pc.input(..., type_="datetime-local")

Yes, the implementation is simple, but it’s a feature that has been discussed multiple times. It’s also the same method used for the email and password components.

@masenf
Copy link
Collaborator

masenf commented Jun 4, 2023

Okay, makes sense. Down the road this will let the project swap out the default components for something more specialized without downstream users having to change their code.

@aidanjrauscher aidanjrauscher force-pushed the main branch 2 times, most recently from 078d362 to 9b44623 Compare June 4, 2023 20:05
@aidanjrauscher aidanjrauscher reopened this Jun 4, 2023
Copy link
Contributor

@picklelo picklelo left a comment

Choose a reason for hiding this comment

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

Thanks for adding! Just some comments about naming to keep it consistent with the other components

@@ -91,6 +91,8 @@
checkbox = Checkbox.create
checkbox_group = CheckboxGroup.create
copy_to_clipboard = CopyToClipboard.create
datepicker = DatePicker.create
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we call this date_picker and date_time_picker(to match the capitalization of the classes)

Copy link
Contributor Author

@aidanjrauscher aidanjrauscher Jun 5, 2023

Choose a reason for hiding this comment

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

changed in commit 7fb7ebf

@@ -0,0 +1,11 @@
"""A date input component."""
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also change the filenames to date_picker.py and date_time_picker.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed in commit 7fb7ebf

Copy link
Contributor

@picklelo picklelo left a comment

Choose a reason for hiding this comment

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

thanks for the update!

@picklelo picklelo merged commit 9812ab2 into reflex-dev:main Jun 5, 2023
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.

Add Datepicker Component (pc.datepicker)
3 participants