Skip to content

Commit

Permalink
FEAT: Deck Item
Browse files Browse the repository at this point in the history
Component for each deck list item, showing name, description, difficulty level and W/L.
  • Loading branch information
diogosilverio committed Jan 20, 2018
1 parent 5eabd0f commit 587dedb
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions components/ui/DeckItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';

import DifficultyMeter from './DifficultyMeter';

import { COLOR_B_1, COLOR_SUCCESS, COLOR_FAILURE } from '../../utils/colors';

export default class DeckItem extends Component {

render() {

const { deck } = this.props;

return (
<View style={styles.mainContainer}>
<View style={styles.diffContainer}>
<DifficultyMeter size={40} level={deck.difficulty} />
</View>
<View style={styles.infoContainer}>
<Text style={styles.name}>{deck.name}</Text>
<Text style={styles.description}>{deck.description}</Text>
</View>
<View style={styles.scoreContainer}>
<View style={{ flex: 1 }}>
<Text style={styles.won}>{deck.won}</Text>
<Text style={styles.lost}>{deck.lost}</Text>
</View>
</View>
</View>
);
}

}

const styles = StyleSheet.create({
mainContainer: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
padding: 5,
borderBottomWidth: 1,
borderBottomColor: COLOR_B_1
},
diffContainer: {
flex: 1,
},
infoContainer: {
flex: 3,
padding: 5,
},
scoreContainer: {
flex: 1,
},
name: {
fontSize: 20,
fontWeight: 'bold'
},
description: {
fontSize: 15,
fontStyle: 'italic',
flexWrap: 'wrap'
},
won: {
flex: 2,
fontSize: 25,
color: '#fff',
backgroundColor: COLOR_SUCCESS,
textAlign: 'center'
},
lost: {
flex: 2,
fontSize: 25,
color: '#fff',
backgroundColor: COLOR_FAILURE,
textAlign: 'center'
}
});

0 comments on commit 587dedb

Please sign in to comment.