FEATURE: added a datepicker module(#237)
Adds #237
Right now it only had the value prop, but I will add more as per comments.
Thanks for taking this on! A couple things the library seems to be react-datepicker does your code work locally? You will also need to add this library to our package.json
As for props and events -In addition to onChange we should support onSelect
More props can be these but snake case: closeOnScroll, dateFormat, startDate, endDate, minDate, maxDate, isClearable, placeholderText, showWeekNumbers, shouldCloseOnSelect
I have added the new props. However, should the date values be of datetime type? Or the framework handle it on its end.
I ahve not tested locally. I am working in a Codespace. The tests are running fine.
Looking good thanks for the changes, can you add comment and doc strings like our other components also can you text to see if it runs locally. https://github.com/pynecone-io/pynecone/blob/main/pynecone/components/datadisplay/datatable.py
I have added the docstring.
I am trying to test locally but I getting a ReferenceError: date_picker_state is not defined. I am following the wrapping docs quite literally. Do I need to define the state separately in the components?
here is my code.
class DatePickerState(pc.State):
date = "1/1/2001"
def index():
return pc.center(
pc.vstack(
pc.heading(DatePickerState.date),
date_picker(on_change=DatePickerState.set_date),
pc.box("Get started by editing ",
pc.code(filename, font_size="1em")),
pc.link(
"Check out our docs!",
href=docs_url,
border="0.1em solid",
padding="0.5em",
border_radius="0.5em",
_hover={
"color": "rgb(107,99,246)",
},
),
spacing="1.5em",
font_size="2em",
),
padding_top="10%",
)
# Add state and page to the app.
app = pc.App(state=State)
app.add_page(index)
app.compile()
It looks like you're passing the wrong State class to your app.
You probably want to do
app = pc.App(state=DatePickerState)
Or if you meant to use substates, you need to make sure your new class subclasses your base state rather than pc.State:
class State(pc.State):
""""Base State"""
class DatePickerState(State):
date = "1/1/2001"
app = pc.App(state=State)
Going to close this pr seems inactive.