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

wrapper for tag list to show/hide tags #324 #397

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smlkA
Copy link

@smlkA smlkA commented Feb 24, 2019

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.

@@ -25,6 +27,7 @@ const TagListLabel = styled.span`
`

const tagColors = ['lipstick', 'vividPurple', 'rouge', 'warmPurple']
const morePlaqueColor = '#545454'
Copy link
Member

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 = {
Copy link
Member

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
Copy link
Member

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>,
Copy link
Member

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 (
Copy link
Member

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

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.

2 participants