Skip to content

refactor: members to styled components#606

Merged
machour merged 9 commits intogitpoint:masterfrom
simonhoyos:refactor-members
Jan 26, 2018
Merged

refactor: members to styled components#606
machour merged 9 commits intogitpoint:masterfrom
simonhoyos:refactor-members

Conversation

@simonhoyos
Copy link
Copy Markdown
Contributor

Screenshots

Before After
screen shot 2017-10-29 at 07 44 04 screen shot 2017-10-29 at 13 23 32
screen shot 2017-10-29 at 09 30 23 screen shot 2017-10-29 at 09 37 23

Description

Migrate Members component to styled-components (#532)

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 39.505% when pulling 1f2b8d3 on shmesa22:refactor-members into 2fda53e on gitpoint:master.

width: 15;
height: ${avatarSize};
${props => props.gradientPosition};
`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some of these have new lines between them, others do not. Is there a pattern you're following or can we clean this up a little?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@andrewda added lines between blocks

`;

const SectionTitle = styled.Text`
color: ${props => (props.isTitleSmall ? colors.primaryDark : colors.black)};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@shmesa22 Maybe brackets should be removed to keep consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@chinesedfan They were added by prettier

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 39.505% when pulling 15e7e1f on shmesa22:refactor-members into 2fda53e on gitpoint:master.

Copy link
Copy Markdown
Member

@machour machour left a comment

Choose a reason for hiding this comment

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

hey again @shmesa22 :)

left you some comments on this PR as well so that we can enhance our usage of styled-components. Some of the requested changes will have to wait for #619 which should be merged pretty soon.

Don't hesitate if you need any help with my feedback

const NoMembersList = styled(StyledList)`
margin-top: 0;
`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of creating a new component, once #619 is merged you can do this as follow:

const NoMembersList = styled(List).attrs({
  containerStyle: {
    margin-top: 0;
  }
})``;

padding-left: 15;
padding-right: 15;
`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as the above comment

<Text style={smallTitle ? styles.sectionTitleSmall : styles.sectionTitle}>
{title}
</Text>
<Container style={containerStyle}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Scanned the code to see where containerStyle is passed, it's only used in <IssueDescription> as follows:

<MembersList
  title={translate('issue.main.assignees', locale)}
  members={issue.assignees}
  containerStyle={{ marginTop: 0, paddingTop: 0, paddingLeft: 0 }}
  smallTitle
  navigation={navigation}
/>

Could you introduce a new boolean prop, like "noMargin" and get rid of containerStyle?

The Container styled component should be updated to read this new props and add the extra css declarations instead. IssueDescription will need to be updated and be part of this PR of course.

Let me know if this is unclear to you, I'll be happy to help

styles.avatarContainer,
{ marginRight: index < members.length - 1 ? 5 : 0 },
]}
style={{ marginRight: index < members.length - 1 ? 5 : 0 }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

underlayColor & style should be generated by styled-components instead

end={{ x: 1, y: 0.5 }}
<ScrollGradient
gradientPosition={{ right: 0 }}
gradientColors={['rgba(255, 255, 255, 0)', 'white']}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we could omit the gradient prefix from prop names, as the component name is ScrollGradient ;)

@machour machour self-assigned this Nov 4, 2017
@machour
Copy link
Copy Markdown
Member

machour commented Nov 7, 2017

@shmesa22, #619 is in, feel free to resume you work at any time (no pressure ❤️ )

@simonhoyos
Copy link
Copy Markdown
Contributor Author

Sorry I went on unexpected 'vacations'. I'll finish all my pending issues ASAP

@coveralls
Copy link
Copy Markdown

coveralls commented Nov 26, 2017

Coverage Status

Coverage decreased (-0.2%) to 43.839% when pulling c20ad6f on shmesa22:refactor-members into 0d694bf on gitpoint:master.

@machour
Copy link
Copy Markdown
Member

machour commented Jan 16, 2018

Hey @shmesa22, what's the status on this one ? 🤔
Let me know if you need any help!

@simonhoyos
Copy link
Copy Markdown
Contributor Author

Hi @machour, I'll finish my pending issues this weekend

Changed from styledFonts to fonts and changed removed containerStyle and added noMargin boolean prop
to add extra css declarations if true
@machour machour merged commit fca571e into gitpoint:master Jan 26, 2018
@machour
Copy link
Copy Markdown
Member

machour commented Jan 26, 2018

Perfect 👌thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants