-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdice-sides-grid.vugu
42 lines (38 loc) · 1000 Bytes
/
dice-sides-grid.vugu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<div class="dice-sides-grid">
<side-roll-counter vg-for='_, counter := range data.Counters' :side-number='counter.SideNumber'></side-roll-counter>
</div>
<style>
.dice-sides-grid {
/*height: 80%;*/
position: absolute;
/* max-height: 100%; */
/* display: block; */
/*margin: auto;*/
display: grid;
grid-row-start: 1;
grid-row-end: 2;
grid-template-columns: repeat(4, 25%);
grid-template-rows: repeat(5, 20%);
grid-auto-flow: row;
place-items: center;
height: 100%;
width: 100%;
}
</style>
<script type="application/x-go">
type DiceSidesGridData struct {
NumSides int `default:"20"`
NumRows int
Counters []SideRollCounterData
}
func (comp *DiceSidesGrid) NewData(props vugu.Props) (interface{}, error) {
numSides := props["sides"].(int)
numRows := props["rows"].(int)
ret := &DiceSidesGridData{
NumSides: numSides,
NumRows: numRows,
Counters: state.SideRollCounters,
}
return ret, nil
}
</script>