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

feat(legends): migrate package to typescript #1512

Merged
merged 1 commit into from
May 12, 2021
Merged

Conversation

wyze
Copy link
Contributor

@wyze wyze commented May 9, 2021

Close #1221
Close #1321

@wyze wyze requested a review from plouc May 9, 2021 02:50
@wyze wyze self-assigned this May 9, 2021
@codesandbox-ci
Copy link

codesandbox-ci bot commented May 9, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ebfcc21:

Sandbox Source
nivo Configuration
nivo-website Configuration
@nivo/pie TypeScript (forked) Issue #1321
@nivo/pie TypeScript (forked) Issue #1321

@wyze wyze merged commit d9ec5fd into master May 12, 2021
@wyze wyze deleted the legends-typescript branch May 12, 2021 19:03
Copy link
Contributor

@jamesdh jamesdh left a comment

Choose a reason for hiding this comment

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

Ultimately I just added a default...

data: [], 
padding: 0

to each of my legend definitions. This got things building again and worked for everything but my line charts which still render but no longer show any legends.

}

export type LegendProps = {
data: Datum[]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is requiring a Datum[] here right? I can't find anything in the Legends guide or in the storybooks demonstrating the use of this or explaining what it's for. This and the required padding above both broke every one of my charts.


type CommonLegendProps = {
direction: LegendDirection
padding: number | Record<'top' | 'right' | 'bottom' | 'left', number>
Copy link
Contributor

@jamesdh jamesdh May 26, 2021

Choose a reason for hiding this comment

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

Similarly, I never used the padding prop before and can't find any form of documentation describing how/what it is used for. Should this really be required?

@wyze
Copy link
Contributor Author

wyze commented May 26, 2021

This got things building again and worked for everything but my line charts which still render but no longer show any legends.

https://github.com/plouc/nivo/blob/master/packages/line/src/Line.js#L193

You have to exclude data from legend prop or it will use it. Looking at the previous props, they should have been not required. Sorry about that.

@jamesdh
Copy link
Contributor

jamesdh commented May 26, 2021

@wyze cool, I wasn't sure if you'd see this post-merge review :)

You have to exclude data from legend prop or it will use it.

Yea, unfortunately that triggers a typescript error since it's required, and so removing it causes the build to fail compilation.

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.

Legend itemTextColor no longer works 0.63+ Migrate @nivo/legends to TypeScript
2 participants