-
Notifications
You must be signed in to change notification settings - Fork 16
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
Comparative Category Widget #505
Conversation
- typings - jsdoc - exports - storybook
Pull Request Test Coverage Report for Build 3429857450
💛 - Coveralls |
…ative-category-widget
…ative-category-widget
* Enum for ComparativeCategoryWidgetUI order types. 'RANKING' orders the data by value and 'FIXED' keep the order present in the original data | ||
* @enum {string} | ||
*/ | ||
export const ORDER_TYPES = { |
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.
Can't we share same order types from CategoryWidget?
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.
Sure, we could move the export const ORDER_TYPES
to CategoryWidgetUI
and use that instead of writing them to CategoryWidgetUI
, so we can import them separately from ComparativeCategoryWidgetUI
.
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.
Solved
} | ||
}))(Tooltip); | ||
|
||
function CategoryItem({ |
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 would strongly suggest splitting this long file, with different components, into different files, one per component. Also I think it would probably make sense to create a bit more of structure in folders:
- widgets
- CategoryWidgetUI
- comparative
- Category
- ComparativeCategoryWidgetUI
- CategoryItem
- Skeleton...
- Category
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.
Agree
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.
Allright, ComparativeCategoryWidget is now split into multiple files and in the folder widgets/comparative
@@ -66,7 +67,7 @@ function ComparativeFormulaWidgetUI({ | |||
} | |||
|
|||
return ( | |||
<div> | |||
<div className={classes.formulaChart}> |
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've removed this class in the previous PR, as it has no content
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.
oh sorry, I thought it was there for something. I will be removing it again
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.
done too
@@ -0,0 +1,47 @@ | |||
import React from 'react'; |
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.
Stories file is obviously very useful for debugging, thx for doing it.
But something we're missing here, and in general in comparative is the unit testing side. Same as we have /tests_/widgets/CategoryWidgetUI.test.js we should have corresponding unit tests for each comparative widget.
That's gonna allow us to maintain it better in the future (or maybe to refactor it to share some pieces...). Would you please?
Would you please
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.
Allright, I will be looking at existing test files and try to create similar ones for comparative widgets
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.
And this one will be a task for tomorrow
@VictorVelarde thanks a lot for your review! |
Hi @juandjara, I see you're advancing well. Ping us when this is ready for a 2nd review, thx! |
…comparative-category-widget
Hi @VictorVelarde! Tests for |
Thx a lot @juandjara, I think you have done a really nice job here ✨ . I'm gonna land it and make 1.5.0-alpha so you can properly review it in your project |
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.
🚀
Description
This PR implements part of the work proposed in RFC #479
This widget uses the component
AnimatedNumber
introduced in PR #504. Because of that, it includes the changes introduced in PR #504. Because of that, this PR should be merged only after PR #504 is mergedChanges added in this PR include:
ComparativeCategoryWidgetUI
in thewidgets
folderComparativeCategoryWidgetUI
and the exported enumORDER_TYPES
ComparativeCategoryWidgetUI
and the exported enumORDER_TYPES
ComparativeCategoryWidgetUI
and all the subcomponents includedComparativeComparativeWidgetUI
where all prop combinations can be tested and tweaked. A screenshot of this storybook is added as visual feedback.Type of change
Acceptance
How to validate the feature:
yarn storybook:start
in thereact-ui
folder.ComparativeCategoryWidgetUI
in your sample project, by importingComparativeCategoryWidgetUI
from@carto/react-ui
. You can use this branch ofcarto-react-template
to skip this step if you want, as a test screen is already setup there. Bear in mind that if this feature is not published to npm you will have to link your local version of@carto/react-*
packages withyarn link
.Basic checklist