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

FEATURE: added a datepicker module(#237) #240

Closed
wants to merge 4 commits into from

Conversation

muddi900
Copy link
Contributor

Adds #237

Right now it only had the value prop, but I will add more as per comments.

@Alek99
Copy link
Member

Alek99 commented Jan 10, 2023

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

fixed name of package

added names to init
@muddi900 muddi900 force-pushed the feature/date-picker branch from 8f50513 to 92bacab Compare January 11, 2023 08:18
@muddi900
Copy link
Contributor Author

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.

@Alek99 Alek99 self-requested a review January 11, 2023 19:14
@Alek99
Copy link
Member

Alek99 commented Jan 12, 2023

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

@muddi900
Copy link
Contributor Author

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()

@picklelo
Copy link
Contributor

picklelo commented Jan 18, 2023

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)

@Alek99
Copy link
Member

Alek99 commented Jan 24, 2023

Going to close this pr seems inactive.

@Alek99 Alek99 closed this Jan 24, 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.

3 participants