Reorganize modules

This commit is contained in:
Nicolas Gallagher
2015-06-14 23:02:55 -07:00
parent 1ba13f6578
commit cb039d075f
52 changed files with 157 additions and 102 deletions

50
example/example.js Normal file
View File

@@ -0,0 +1,50 @@
import React from 'react';
import { Image, Text, View } from '../dist/main';
class Example extends React.Component {
render() {
return (
<View>
<View style={styles.grid}>
{[1,2,3,4,5,6].map((item, i) => {
return (
<View key={i} style={{ ...styles.box, ...(item === 6 && styles.boxFull) }}>
<Text style={{ fontSize: '2rem' }}>{item}</Text>
</View>
);
})}
</View>
<View style={{
alignItems: 'center',
borderWidth: '1px',
justifyContent: 'center',
marginTop: '10px',
height: '200px'
}}>
<Text>This should be centered</Text>
</View>
</View>
);
}
}
const styles = {
grid: {
flexDirection: 'row',
flexWrap: 'wrap'
},
box: {
alignItems: 'center',
backgroundColor: 'lightblue',
flexGrow: 1,
justifyContent: 'center',
borderColor: 'blue',
borderWidth: '5px'
},
boxFull: {
width: '100%'
}
}
React.render(<Example />, document.getElementById('react-root'));

6
example/index.html Normal file
View File

@@ -0,0 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../dist/react-web-sdk.css">
<div id="react-root"></div>
<script src="../dist/example.js"></script>

19
example/webpack.config.js Normal file
View File

@@ -0,0 +1,19 @@
module.exports = {
entry: {
example: './example.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: { cacheDirectory: true }
}
]
},
output: {
filename: 'example.js',
path: '../dist'
}
};