Skip to content

Commit 1796877

Browse files
committed
Beefed up Grid playground
1 parent 2e308ed commit 1796877

2 files changed

Lines changed: 37 additions & 4 deletions

File tree

playground/grid.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,27 @@
1111
margin: 0;
1212
padding: 0;
1313
}
14+
.cell {
15+
display: flex;
16+
flex-direction: row;
17+
}
18+
.button {
19+
appearance: none;
20+
border: none;
21+
background-color: #DDD;
22+
border-radius: 4px;
23+
display: flex;
24+
align-content: center;
25+
}
1426
.input {
15-
width: 100%;
27+
width: 50px;
1628
height: 100%;
1729
box-sizing: border-box;
1830
}
31+
.image {
32+
height: 20px;
33+
width: auto;
34+
}
1935
</style>
2036
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react.js"></script>
2137
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"></script>

playground/grid.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1+
var REACT_VIRTUALIZED_BANNER = 'https://cloud.githubusercontent.com/assets/29597/11737732/0ca1e55e-9f91-11e5-97f3-098f2f8ed866.png'
2+
13
function renderCell (params) {
2-
return React.DOM.input({
4+
var key = `c:${params.columnIndex}, r:${params.rowIndex}`
5+
var input = React.DOM.input({
36
className: 'input',
4-
onChange: function () {},
5-
defaultValue: `column:${params.columnIndex}, row:${params.rowIndex}`
7+
defaultValue: key,
8+
key: 'input',
9+
onChange: function () {}
10+
})
11+
var button = React.DOM.button({
12+
className: 'button',
13+
key: 'button'
14+
}, key)
15+
var image = React.DOM.img({
16+
className: 'image',
17+
key: 'image',
18+
src: REACT_VIRTUALIZED_BANNER
619
})
20+
21+
return React.DOM.div({
22+
className: 'cell'
23+
}, [input, button, image])
724
}
825

926
var App = React.createClass({

0 commit comments

Comments
 (0)