Skip to content

Commit fe8939c

Browse files
author
rofrischmann
committed
#9 added a small and ugly demo page
Someone could clean it up and prettify the styles, for now this closes #9
1 parent 30fb0bc commit fe8939c

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

demo/app.jsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React from 'react'
2+
import { render } from 'react-dom'
3+
import Box, { ScrollView, Page } from '../lib/index'
4+
5+
const Example = () => (
6+
<Box fit column>
7+
<Box center width="100%" flex="0 0 400px" justifyContent="space-between" style={styles.redBox}>
8+
400x400 (inclusive 30px padding)
9+
<Box width={200} justifyContent="flex-end">
10+
<Box style={styles.greenBox}>
11+
auto-size (+ 20px padding)
12+
</Box>
13+
</Box>
14+
<Box height={400} minWidth={100} style={styles.blueBox} onClick={() => {
15+
this.scrollTop()
16+
}}>
17+
400x min(100) (inclusive 10px padding)
18+
</Box>
19+
</Box>
20+
<ScrollView width="100%" flex={1} style={styles.scrollView} onScroll={(scrollPos) => {
21+
return false
22+
}}>
23+
{new Array(160).join().split(',').map((item, i) => <Box flexShrink={0} minHeight={40} style={styles.listItem}>Scroll Item {i}</Box>)}
24+
</ScrollView>
25+
</Box>
26+
)
27+
28+
const styles = {
29+
redBox: {
30+
padding: 30,
31+
background: 'red'
32+
},
33+
greenBox: {
34+
padding: 20,
35+
background: 'green'
36+
},
37+
blueBox: {
38+
padding: 10,
39+
background: 'blue'
40+
},
41+
scrollView: {
42+
background: 'gray'
43+
},
44+
listItem: {
45+
borderBottom: '1px solid black'
46+
}
47+
}
48+
49+
render(<Example />, document.body)

demo/index.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="format-detection" content="telephone=no" />
7+
<meta name="msapplication-tap-highlight" content="no" />
8+
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" />
9+
<title>Box Example</title>
10+
<style>
11+
html,
12+
body {
13+
height: 100%;
14+
width: 100%;
15+
}
16+
* {
17+
padding: 0;
18+
margin: 0;
19+
box-sizing: border-box;
20+
}
21+
</style>
22+
</head>
23+
24+
<body>
25+
</body>
26+
<script type="text/javascript" src="bundle.js"></script>
27+
28+
</html>

0 commit comments

Comments
 (0)