Skip to content

Commit b7e0308

Browse files
committed
Spacing out hint stuff better
1 parent ef5d27b commit b7e0308

File tree

5 files changed

+44
-17
lines changed

5 files changed

+44
-17
lines changed

app/js/hint/HintView.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ var HintView = module.exports = Backbone.View.extend({
2424
this.$el = $('<div></div>').attr('class', 'hint');
2525

2626
// if the user has found a set, remove the hint
27-
Backbone.on("setFound", function(){
27+
Backbone.on('setFound', function(){
2828
this.$el.fadeOut(function(){
2929
this.$el.empty();
3030
}.bind(this));
3131
}.bind(this));
3232

3333
// if the cards are finished dealing, show hint
34-
Backbone.on("cardsDealt", function(){
34+
Backbone.on('cardsDealt', function(){
3535
this.renderHintLink();
3636
}.bind(this));
3737
},
@@ -60,23 +60,28 @@ var HintView = module.exports = Backbone.View.extend({
6060
if (e){ e.preventDefault(); }
6161

6262
var sets = this.cards.findSets();
63-
64-
this.$el.html(setCountTemplate({
65-
setCountText: this.getCountText(sets)
66-
}));
6763

64+
this.$el.fadeOut(function(){
65+
this.$el.html(setCountTemplate({
66+
setCountText: this.getCountText(sets)
67+
}));
68+
this.$el.fadeIn();
69+
}.bind(this));
6870
},
6971

7072
renderSets: function(e){
7173

7274
if (e){ e.preventDefault(); }
7375

76+
// make mini cards
7477
var sets = this.cards.findSets().map(function(set){
75-
// return new CardView()
78+
7679
return set.map(function(card){
7780
// make sure we clone the model so it doesn't interfer with the real card
7881
var cv = new CardView({model: card.clone()});
7982
cv.$el.addClass('card--mini');
83+
84+
// return html string
8085
return cv.$el.prop('outerHTML');
8186
});
8287
});

app/js/hint/templates/hint.handlebars

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<a href="#" class="get-hint">hint</a>
1+
<div class="hint__title">
2+
<a href="#" class="get-hint">hint</a>
3+
</div>
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
<div>{{setCountText}}</div>
1+
<div class="hint__title">
2+
{{setCountText}}<br>
23
(<a href="#" class="show-me">show me</a>)
4+
</div>
+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
<div>{{setCountText}}</div>
1+
<div class="hint__title">{{setCountText}}</div>
2+
3+
<div class="hint__sets">
24
{{#each sets}}
3-
<div class="hint__set-holder">
5+
<div class="hint__set">
46
{{#each this}}
5-
{{{this}}}
7+
{{{this}}}
68
{{/each}}
79
</div>
810
{{/each}}
11+
</div>

app/styl/hint.styl

+20-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
text-align: right;
44
color: #999;
55

6+
padding: 16px 0;
7+
68
a,
79
a:link,
810
a:visited
@@ -13,18 +15,31 @@
1315
}
1416
}
1517

16-
.hint__set-holder {
17-
display: inline-flex;
18-
vertical-align: middle;
19-
flex-direction: row;
20-
margin: 0 5px 5px;
18+
.hint__sets {
19+
display: flex;
20+
flex-direction: row-reverse;
21+
flex-wrap: wrap;
22+
}
23+
.hint__set {
24+
flex: 0 0 25%;
25+
padding: 0 10px 10px;
26+
27+
display: flex;
28+
justify-content: center;
29+
}
30+
31+
.hint__title {
32+
padding: 0 10px 10px;
2133
}
2234

2335
.card.card--mini {
2436
width: 30px;
2537
height: 45px;
2638
position: relative;
2739
margin: 1px;
40+
box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.3);
41+
border-radius: 3px;
42+
cursor: default;
2843

2944
.shape {
3045
margin: 1px 0;

0 commit comments

Comments
 (0)