-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Definitions for Pie component #207
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Psvensso, thank you very much for this, I just have a few feedbacks.
packages/nivo-pie/index.d.ts
Outdated
|
||
export type SettingsGetterFunc = (dataSlize: IPieDataITem) => string; | ||
|
||
export interface IPieProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The theme & animation props are missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, colors
& colorBy
, it's not obvious as it's added by the enhancer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting this i just couldent follow the enchancer deeå enough to see the props added. I will have another go later.
packages/nivo-pie/index.d.ts
Outdated
|
||
export interface IPieProps { | ||
data: Array<IPieDataItem>; | ||
sortByValue: bool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not required, default to false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact, except for data
, all is optional as it's non required/defined in default props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of the approach used for bar (with Partial
)? https://github.com/plouc/nivo/blob/master/packages/nivo-bar/index.d.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw that they were all .required by the ReactProps.
Partial is a fine technique by me if they are all optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, some properties are required, but because the definition targets exposed API, you'll have defaultProps applied, so we have to take propTypes & defaultProps in account when creating definitions.
packages/nivo-pie/index.d.ts
Outdated
|
||
export type LegendDirection = 'row' | 'column'; | ||
|
||
export interface INivoLegendItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I
should be removed, as others packages do not use this form, and maybe Nivo
should be removed too
packages/nivo-pie/index.d.ts
Outdated
data: Array<IPieDataItem>; | ||
sortByValue: bool; | ||
export type PieProps = Partial<{ | ||
data: Array<PieDataItem>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data is required, that's why it was handled separately for Bar components
export type LegendDirection = 'row' | 'column'; | ||
|
||
export type Legend = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review the optional props. in Legend. Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems ok
When using the code given in the nivo.rocks example I receive the following error:
|
Sorry, didn't tried it yet.
Unfortunately, I'm in a middle of something for now (Pie improvements, start/end angle support, canvas…), so I won't be able to fix this now. |
I've created #215 |
closes #206
ref: #197
I had to include the INivoLegendItem. Not sure if its possible to re-use definition files from other packages. If so when creating the legend definitions we could/should perhaps refactor this.