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

Update usage example #15

Open
jgoldm opened this issue Jan 17, 2023 · 1 comment
Open

Update usage example #15

jgoldm opened this issue Jan 17, 2023 · 1 comment

Comments

@jgoldm
Copy link

jgoldm commented Jan 17, 2023

Hello,

The usage example is outdated and I am having some trouble getting the cards to render.

Here is what I noticed needs to be updated:

const [till] = React.useState(moment().add(3, 'days').toDate());    // instead of toISOString();

renderItem={renderMyItemCard}   // instead of cardComponent={myItemCard}

export default function MyItemCard({title, startDate, endDate})    // I'm not sure how to properly set up this component

Thank you

@dorkyboi
Copy link
Owner

Hi, @jgoldm.

const [till] = React.useState(moment().add(3, 'days').toDate()); // instead of toISOString();
This is still up-to-date, we support all values supported by Date() constructor, meaning ISO string, UNIX timestamp (number) or Date object are all valid values.

renderItem={renderMyItemCard} // instead of cardComponent={myItemCard}
Thanks for catching this, I will update it ASAP.

export default function MyItemCard({title, startDate, endDate})
This would be your component, responsible for rendering your cards. It receives a bunch of props, so that you could customize your cards appropriately. But, because cardComponent prop is no longer in play, its usage is slightly different, which will also be reflected in the docs.
For now, you can use it like this:

<Timetable
    {/* other props */}
    renderItem={props => <MyItemCard {...props}/>}
/>

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

No branches or pull requests

2 participants