Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,13 @@
"contributions": [
"code"
]
},
{
"login": "MrLoh",
"name": "Tobias Lohse",
"avatar_url": "https://avatars0.githubusercontent.com/u/1285032?v=4",
"profile": "http://MrLoh.se",
"contributions": []
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.

🎉 You contributed codes in fact.

}
]
}
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Thank you to all the people who have already contributed to GitPoint!
| [<img src="https://avatars0.githubusercontent.com/u/18398761?v=4" width="100px;"/><br /><sub>Vitaliy Kanev</sub>](https://github.com/vitalkanev)<br />[📖](https://github.com/gitpoint/git-point/commits?author=vitalkanev "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/3691490?v=4" width="100px;"/><br /><sub>Peter Dave Hello</sub>](https://www.peterdavehello.org/)<br />[📖](https://github.com/gitpoint/git-point/commits?author=PeterDaveHello "Documentation") [🔧](#tool-PeterDaveHello "Tools") | [<img src="https://avatars3.githubusercontent.com/u/10849025?v=4" width="100px;"/><br /><sub>Ernoff</sub>](https://github.com/Ernoff)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Ernoff "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3AErnoff "Bug reports") | [<img src="https://avatars3.githubusercontent.com/u/820696?v=4" width="100px;"/><br /><sub>Matthew Brandly</sub>](http://words.brandly.me/about/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=brandly "Code") | [<img src="https://avatars2.githubusercontent.com/u/11836470?v=4" width="100px;"/><br /><sub>João Fonseca</sub>](https://github.com/Jpfonseca)<br />[🌍](#translation-Jpfonseca "Translation") | [<img src="https://avatars3.githubusercontent.com/u/10121964?v=4" width="100px;"/><br /><sub>Arjun Curat</sub>](https://github.com/acurat)<br />[📖](https://github.com/gitpoint/git-point/commits?author=acurat "Documentation") |
| [<img src="https://avatars3.githubusercontent.com/u/16878891?v=4" width="100px;"/><br /><sub>siderio2</sub>](https://github.com/siderio2)<br />[🌍](#translation-siderio2 "Translation") | [<img src="https://avatars1.githubusercontent.com/u/32579769?v=4" width="100px;"/><br /><sub>Kodo Verkisto</sub>](https://github.com/kodisto)<br />[🌍](#translation-kodisto "Translation") | [<img src="https://avatars3.githubusercontent.com/u/82317?v=4" width="100px;"/><br /><sub>Sarah Vessels</sub>](http://sarahvessels.com/)<br />[📖](https://github.com/gitpoint/git-point/commits?author=cheshire137 "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/3764756?v=4" width="100px;"/><br /><sub>Thales Sousa</sub>](https://github.com/tminussi)<br />[🌍](#translation-tminussi "Translation") | [<img src="https://avatars0.githubusercontent.com/u/6106941?v=4" width="100px;"/><br /><sub>Aseem Sood</sub>](https://github.com/asood123)<br />[📖](https://github.com/gitpoint/git-point/commits?author=asood123 "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/7842156?v=4" width="100px;"/><br /><sub>Eliott hauteclair</sub>](https://eliott.be)<br />[🌍](#translation-Eliottiosdevs "Translation") |
| [<img src="https://avatars3.githubusercontent.com/u/14539?v=4" width="100px;"/><br /><sub>Peter Blazejewicz</sub>](http://www.linkedin.com/in/peterblazejewicz)<br />[🌍](#translation-peterblazejewicz "Translation") | [<img src="https://avatars0.githubusercontent.com/u/6516758?v=4" width="100px;"/><br /><sub>Eric Adamski</sub>](https://github.com/ericadamski)<br />[🐛](https://github.com/gitpoint/git-point/issues?q=author%3Aericadamski "Bug reports") | [<img src="https://avatars2.githubusercontent.com/u/1559013?v=4" width="100px;"/><br /><sub>Jouderian Nobre Junior</sub>](https://github.com/jouderianjr)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jouderianjr "Code") | [<img src="https://avatars2.githubusercontent.com/u/5158502?v=4" width="100px;"/><br /><sub>Phi Dong</sub>](http://www.phidong.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=pdong "Code") | [<img src="https://avatars2.githubusercontent.com/u/17956698?v=4" width="100px;"/><br /><sub>John Patrick Salcedo</sub>](https://github.com/jpls93)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jpls93 "Code") | [<img src="https://avatars2.githubusercontent.com/u/11599942?v=4" width="100px;"/><br /><sub>Óscar Carretero</sub>](https://github.com/ocarreterom)<br />[💻](https://github.com/gitpoint/git-point/commits?author=ocarreterom "Code") |
| [<img src="https://avatars3.githubusercontent.com/u/5528931?v=4" width="100px;"/><br /><sub>Dyesse YUMBA</sub>](https://github.com/dyesseyumba)<br />[🔧](#tool-dyesseyumba "Tools") | [<img src="https://avatars0.githubusercontent.com/u/20456165?v=4" width="100px;"/><br /><sub>Bink</sub>](https://binkpitch.me/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=binkpitch "Code") | [<img src="https://avatars2.githubusercontent.com/u/10085841?v=4" width="100px;"/><br /><sub>khvilaboa</sub>](https://github.com/khvilaboa)<br />[🌍](#translation-khvilaboa "Translation") | [<img src="https://avatars1.githubusercontent.com/u/40802?v=4" width="100px;"/><br /><sub>James Glover</sub>](http://jamesmglover.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jglover "Code") |
| [<img src="https://avatars3.githubusercontent.com/u/5528931?v=4" width="100px;"/><br /><sub>Dyesse YUMBA</sub>](https://github.com/dyesseyumba)<br />[🔧](#tool-dyesseyumba "Tools") | [<img src="https://avatars0.githubusercontent.com/u/20456165?v=4" width="100px;"/><br /><sub>Bink</sub>](https://binkpitch.me/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=binkpitch "Code") | [<img src="https://avatars2.githubusercontent.com/u/10085841?v=4" width="100px;"/><br /><sub>khvilaboa</sub>](https://github.com/khvilaboa)<br />[🌍](#translation-khvilaboa "Translation") | [<img src="https://avatars1.githubusercontent.com/u/40802?v=4" width="100px;"/><br /><sub>James Glover</sub>](http://jamesmglover.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jglover "Code") | [<img src="https://avatars0.githubusercontent.com/u/1285032?v=4" width="100px;"/><br /><sub>Tobias Lohse</sub>](http://MrLoh.se)<br /> |
<!-- ALL-CONTRIBUTORS-LIST:END -->
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
## Introduction

[![Build Status](https://img.shields.io/travis/gitpoint/git-point.svg?style=flat-square)](https://travis-ci.org/gitpoint/git-point)
[![All Contributors](https://img.shields.io/badge/all_contributors-58-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-59-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)
[![Gitter chat](https://img.shields.io/badge/chat-on_gitter-008080.svg?style=flat-square)](https://gitter.im/git-point)
Expand Down
184 changes: 87 additions & 97 deletions src/components/comment-list-item.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { StyleSheet, View, Text, TouchableOpacity, Image } from 'react-native';
import styled from 'styled-components/native';
import { GithubHtmlView } from 'components';
import { Icon } from 'react-native-elements';
import ActionSheet from 'react-native-actionsheet';
Expand All @@ -13,71 +13,71 @@ import moment from 'moment/min/moment-with-locales.min';
import { translate } from 'utils';
import { colors, fonts, normalize } from 'config';

const styles = StyleSheet.create({
container: {
paddingRight: 10,
paddingTop: 10,
backgroundColor: 'transparent',
},
header: {
flexDirection: 'row',
marginLeft: 10,
alignItems: 'center',
},
avatarContainer: {
backgroundColor: colors.greyLight,
borderRadius: 17,
width: 34,
height: 34,
},
avatar: {
width: 34,
height: 34,
borderRadius: 17,
},
titleSubtitleContainer: {
justifyContent: 'center',
flex: 1,
marginLeft: 10,
},
dateContainer: {
flex: 0.15,
alignItems: 'flex-end',
justifyContent: 'center',
},
linkDescription: {
...fonts.fontPrimaryBold,
fontSize: normalize(13),
color: colors.primaryDark,
},
date: {
color: colors.greyDark,
},
commentContainer: {
paddingTop: 5,
marginLeft: 54,
borderBottomColor: colors.greyLight,
borderBottomWidth: 1,
},
commentBottomPadding: {
paddingBottom: 15,
},
commentText: {
fontSize: normalize(12),
color: colors.primaryDark,
},
commentTextNone: {
...fonts.fontPrimary,
color: colors.primaryDark,
fontStyle: 'italic',
},
actionButtonIconContainer: {
paddingTop: 5,
paddingBottom: 10,
alignItems: 'flex-end',
justifyContent: 'center',
},
});
const Container = styled.View`
padding: 10px 10px 0 0;
background-color: transparent;
`;

const Header = styled.View`
flex-direction: row;
margin-left: 10px;
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.

Nice catch for those shorthands properties. But shall we always add units for properties? (cc @alejandronanez)

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.

I don’t know. It’s up to you. I never use units for 0 in css.

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.

I think we should stick to unitless, that's what we've been doing in other PRs

align-items: center;
`;

const AvatarContainer = styled.TouchableOpacity`
background-color: ${colors.greyLight};
border-radius: 17px;
width: 34px;
height: 34px;
`;

const Avatar = styled.Image`
border-radius: 17px;
width: 34px;
height: 34px;
`;

const TitleSubtitleContainer = styled.View`
justify-content: center;
flex: 1;
margin-left: 10px;
`;

const DateContainer = styled.View`
flex: 0.1;
align-items: flex-end;
justify-content: center;
`;

const LinkDescription = styled.Text`
${{ ...fonts.fontPrimaryBold }};
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.

Can we just write as ${fonts.fontPrimaryBold}?

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.

I don’t kno. I’m not sure how this actually works. Just copied it from the other already concerted components. I handle fonts differently in my apps.

Copy link
Copy Markdown
Member

@machour machour Nov 4, 2017

Choose a reason for hiding this comment

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

This should be:

font-family: ${styledFonts.fontPrimaryBold}

EDIT: Actually, let's keep it like you did, I think it would be better to get rid of styledFonts. I'll open a PR for this.

font-size: ${normalize(13)};
color: ${colors.primaryDark};
`;

const DateLabel = styled.Text`
color: ${colors.greyDark};
`;

const CommentContainer = styled.View`
padding-top: 5px;
margin-left: 54px;
border-bottom-color: ${colors.greyLight};
border-bottom-width: 1px;
padding-bottom: ${props => (props.bottomPadding ? 15 : 0)}px;
`;

const CommentTextNone = styled.Text`
${{ ...fonts.fontPrimary }};
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 here.

color: ${colors.primaryDark};
font-style: italic;
`;

const ActionButtonIconContainer = styled.View`
padding: 5px 0;
align-items: flex-end;
justify-content: center;
`;

const mapStateToProps = state => ({
authUser: state.auth.user,
Expand Down Expand Up @@ -133,11 +133,10 @@ class CommentListItemComponent extends Component {
comment.user && authUser.login === comment.user.login;

return (
<View style={styles.container}>
<View style={styles.header}>
<Container>
<Header>
{comment.user && (
<TouchableOpacity
style={styles.avatarContainer}
<AvatarContainer
onPress={() =>
navigation.navigate(
authUser.login === comment.user.login
Expand All @@ -148,19 +147,17 @@ class CommentListItemComponent extends Component {
}
)}
>
<Image
style={styles.avatar}
<Avatar
source={{
uri: comment.user.avatar_url,
}}
/>
</TouchableOpacity>
</AvatarContainer>
)}

{comment.user && (
<View style={styles.titleSubtitleContainer}>
<Text
style={styles.linkDescription}
<TitleSubtitleContainer>
<LinkDescription
onPress={() =>
navigation.navigate(
authUser.login === comment.user.login
Expand All @@ -172,46 +169,39 @@ class CommentListItemComponent extends Component {
)}
>
{comment.user.login}
</Text>
</View>
</LinkDescription>
</TitleSubtitleContainer>
)}

<View style={styles.dateContainer}>
<Text style={styles.date}>
{moment(comment.created_at).fromNow()}
</Text>
</View>
</View>

<View
style={[
styles.commentContainer,
!isActionMenuEnabled && styles.commentBottomPadding,
]}
>
<DateContainer>
<DateLabel>{moment(comment.created_at).fromNow()}</DateLabel>
</DateContainer>
</Header>

<CommentContainer bottomPadding={!isActionMenuEnabled}>
{commentPresent ? (
<GithubHtmlView
source={comment.body_html}
onLinkPress={onLinkPress}
/>
) : (
<Text style={styles.commentTextNone}>
<CommentTextNone>
{translate('issue.main.noDescription', locale)}
</Text>
</CommentTextNone>
)}

{isActionMenuEnabled && (
<View style={styles.actionButtonIconContainer}>
<ActionButtonIconContainer>
<Icon
color={colors.grey}
size={20}
name={'ellipsis-h'}
type={'font-awesome'}
onPress={this.showMenu}
/>
</View>
</ActionButtonIconContainer>
)}
</View>
</CommentContainer>

<ActionSheet
ref={o => {
Expand All @@ -225,7 +215,7 @@ class CommentListItemComponent extends Component {
cancelButtonIndex={this.commentActionSheetOptions(comment).length}
onPress={this.handlePress}
/>
</View>
</Container>
);
}
}
Expand Down