Add colors to channels and space items as material design

This commit is contained in:
Diego Sampaio 2017-08-13 12:10:50 -03:00
parent 196e91cf4b
commit a2ac448e48
No known key found for this signature in database
GPG Key ID: E060152B30502562
2 changed files with 3163 additions and 409 deletions

View File

@ -10,30 +10,30 @@ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
flexDirection: 'row', flexDirection: 'row',
padding: 10, paddingLeft: 16,
paddingLeft: 14, paddingRight: 56,
height: 56,
alignItems: 'center' alignItems: 'center'
}, },
number: { number: {
minWidth: 20, minWidth: 20,
padding: 2,
borderRadius: 5, borderRadius: 5,
backgroundColor: '#aaa', backgroundColor: '#1d74f5',
color: '#fff', color: '#fff',
textAlign: 'center', textAlign: 'center',
overflow: 'hidden', overflow: 'hidden',
marginRight: 15, fontSize: 14,
fontSize: 14 right: 16,
marginLeft: 16,
position: 'absolute'
}, },
roomItem: { roomName: {
flexGrow: 1, flexGrow: 1,
fontSize: 20, fontSize: 16,
color: '#444' color: '#444',
marginLeft: 16
}, },
iconContainer: { iconContainer: {
marginTop: 5,
marginRight: 10,
backgroundColor: '#ccc',
height: 40, height: 40,
width: 40, width: 40,
borderRadius: 20, borderRadius: 20,
@ -42,20 +42,20 @@ const styles = StyleSheet.create({
alignItems: 'center' alignItems: 'center'
}, },
icon: { icon: {
height: 40,
width: 40,
borderRadius: 20,
lineHeight: 30,
fontSize: 20, fontSize: 20,
color: '#fff', color: '#fff',
backgroundColor: '#ccc',
height: 36,
width: 36,
borderRadius: 18,
overflow: 'hidden', overflow: 'hidden',
textAlign: 'center', textAlign: 'center'
lineHeight: 36
}, },
avatar: { avatar: {
width: 40, width: 40,
height: 40, height: 40,
position: 'absolute' position: 'absolute',
borderRadius: 20
}, },
avatarInitials: { avatarInitials: {
fontSize: 22, fontSize: 22,
@ -80,8 +80,9 @@ export default class RoomItem extends React.PureComponent {
return null; return null;
} }
const { name } = this.props.item;
if (this.props.item.t === 'd') { if (this.props.item.t === 'd') {
const { name } = this.props.item;
const { initials, color } = avatarInitialsAndColor(name); const { initials, color } = avatarInitialsAndColor(name);
return ( return (
<View style={[styles.iconContainer, { backgroundColor: color }]}> <View style={[styles.iconContainer, { backgroundColor: color }]}>
@ -91,9 +92,11 @@ export default class RoomItem extends React.PureComponent {
); );
} }
const { color } = avatarInitialsAndColor(name);
return ( return (
<View style={styles.iconContainer}> <View style={styles.iconContainer}>
<MaterialCommunityIcons name={icon} style={styles.icon} /> <MaterialCommunityIcons name={icon} style={[styles.icon, { backgroundColor: color }]} />
</View> </View>
); );
} }
@ -109,11 +112,14 @@ export default class RoomItem extends React.PureComponent {
} }
render() { render() {
const { name } = this.props.item; let extraSpace = {};
if (this.props.item.unread) {
extraSpace = { paddingRight: 92 };
}
return ( return (
<View style={styles.container}> <View style={[styles.container, extraSpace]}>
{this.icon} {this.icon}
<Text style={styles.roomItem}>{ name }</Text> <Text style={styles.roomName} ellipsizeMode='tail' numberOfLines={1}>{ this.props.item.name }</Text>
{this.renderNumber(this.props.item)} {this.renderNumber(this.props.item)}
</View> </View>
); );

3518
package-lock.json generated

File diff suppressed because it is too large Load Diff