-
Notifications
You must be signed in to change notification settings - Fork 43
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
wrapper for tag list to show/hide tags #324 #397
base: master
Are you sure you want to change the base?
Conversation
@@ -25,6 +27,7 @@ const TagListLabel = styled.span` | |||
` | |||
|
|||
const tagColors = ['lipstick', 'vividPurple', 'rouge', 'warmPurple'] | |||
const morePlaqueColor = '#545454' |
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.
move it to src/utils/css-utils.js
please, there is speations colors objects there
@@ -67,3 +131,14 @@ TagList.defaultProps = { | |||
selectedTags: [], | |||
onTagClick: () => null, | |||
} | |||
|
|||
TagListCutter.propTypes = { |
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.
it is prefered to use Flow
instead of propTypes
selectedTags={selectedTags} | ||
onTagClick={toggleTag} | ||
/> | ||
<TagListCutter |
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.
To tell the truth this composition looks pretty complex.
It would be much simpler if the logic related to expanding/collapsing tags just live in Tags component.
label, | ||
theme, | ||
onTagClick, | ||
LabelComponent = label => <TagListLabel>{label}</TagListLabel>, |
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.
if you are using render props, it is better to name them renderLabel
, renderMoreTags
to make it clearer for the user of the component what should he pass in.
import React from 'react' | ||
|
||
const DownArrowIcon = props => { | ||
return ( |
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.
no need in function body and return
statement here
Issue:
#324
also I have implemented different initial number of visible tags for different screen sizes (currently 2 options to set: mobile and desktop).
If animation of expanding/collapsing is required I may add it.