|
@@ -17,23 +17,23 @@ module rpgcards {
|
17
|
17
|
interface DeckTileState {
|
18
|
18
|
}
|
19
|
19
|
|
20
|
|
- export function tileHeader(id: string, name: string) {
|
|
20
|
+ export function tileHeader(props: DeckTileProps) {
|
21
|
21
|
return React.DOM.div
|
22
|
22
|
( { className: 'deck-tile-header', onClick: null }
|
23
|
|
- , React.DOM.div({ className: 'deck-tile-header-name' }, name)
|
24
|
|
- , React.DOM.div({ className: 'deck-tile-header-id' }, id.substring(0, 5))
|
|
23
|
+ , React.DOM.div({ className: 'deck-tile-header-name' }, props.name)
|
|
24
|
+ , React.DOM.div({ className: 'deck-tile-header-id' }, props.id)
|
25
|
25
|
);
|
26
|
26
|
}
|
27
|
27
|
|
28
|
|
- export function tileBody(description: string) {
|
|
28
|
+ export function tileBody(props: DeckTileProps) {
|
29
|
29
|
return React.DOM.div
|
30
|
30
|
( { className: 'deck-tile-body', onClick: null }
|
31
|
|
- , description
|
|
31
|
+ , props.desc
|
32
|
32
|
);
|
33
|
33
|
}
|
34
|
34
|
|
35
|
|
- export function tileFooter(cards: number) {
|
36
|
|
- let cardsText = "This deck contains " + cards + " cards.";
|
|
35
|
+ export function tileFooter(props: DeckTileProps) {
|
|
36
|
+ let cardsText = props.cards + " cards";
|
37
|
37
|
return React.DOM.div
|
38
|
38
|
( { className: 'deck-tile-footer', onClick: null }
|
39
|
39
|
, cardsText
|
|
@@ -61,16 +61,12 @@ module rpgcards {
|
61
|
61
|
}
|
62
|
62
|
|
63
|
63
|
render() {
|
64
|
|
- let deckId = this.props.id;
|
65
|
|
- let deckName = this.props.name;
|
66
|
|
- let deckDesc = this.props.desc;
|
67
|
|
- let deckCards = this.props.cards;
|
68
|
64
|
|
69
|
65
|
return React.DOM.div
|
70
|
66
|
( { className: 'deck-tile' }
|
71
|
|
- , tileHeader(deckId, deckName)
|
72
|
|
- , tileBody(deckDesc)
|
73
|
|
- , tileFooter(deckCards)
|
|
67
|
+ , tileHeader(this.props)
|
|
68
|
+ , tileBody(this.props)
|
|
69
|
+ , tileFooter(this.props)
|
74
|
70
|
);
|
75
|
71
|
}
|
76
|
72
|
}
|