1
1
mirror of https://github.com/c8r/x0.git synced 2024-09-11 21:57:26 +03:00

Start cleaning up docs

This commit is contained in:
Brent Jackson 2017-10-07 18:03:48 -04:00
parent 490587716d
commit a7256ff76d
4 changed files with 40 additions and 61 deletions

View File

@ -3,65 +3,17 @@ import connect from 'refunk'
import Title from './Title'
import cxs from 'cxs/component'
import Router from '../lib/Router'
import Style from './Style'
const { Route, Link } = Router
const dec = state => ({ count: state.count - 1 })
const inc = state => ({ count: state.count + 1 })
const Debug = props => <pre children={JSON.stringify(props, null, 2)} />
const Home = props => (
<div>
<h2>Home</h2>
</div>
)
const css = `
*{box-sizing:border-box}
body {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
line-height: 1.5;
}
`
const Style = ({ css }) => (
<style
dangerouslySetInnerHTML={{
__html: css
}}
/>
)
const App = connect(props => (
<div>
<title>Hi x0</title>
<meta charSet='utf-8' />
<Style css={css + (props.css || '')} />
<Title>Hello async {props.count}</Title>
<button
onClick={e => props.update(dec)}
children='-'
/>
<button
onClick={e => props.update(inc)}
children='+'
/>
<Router
basename={props.basename}
location={props.pathname}>
<nav>
<Link to='/'>Home</Link>
<Link to='/debug'>Debug</Link>
</nav>
<Route exact path='/'
component={Home}
/>
<Route path='/debug'
render={() => <Debug {...props} />}
/>
</Router>
<title>{props.title}</title>
<meta name='description' content={props.description} />
<Style css={props.css} />
<Title>x0</Title>
</div>
))

5
docs/Debug.js Normal file
View File

@ -0,0 +1,5 @@
import React from 'react'
const Debug = props => <pre children={JSON.stringify(props, null, 2)} />
export default Debug

22
docs/Style.js Normal file
View File

@ -0,0 +1,22 @@
import React from 'react'
const Style = ({ css = '' }) => (
<style
dangerouslySetInnerHTML={{
__html: base + css
}}
/>
)
const base = `
*{box-sizing:border-box}
body {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
line-height: 1.5;
color: white;
background-color: black;
min-height: 100vh;
}
`
export default Style

View File

@ -1,7 +1,7 @@
{
"name": "@compositor/x0",
"version": "2.0.0-0",
"description": "Zero-config React renderer and CLI",
"description": "Zero-config React development environment and static site generator",
"main": "index.js",
"bin": {
"x0": "bin/cli.js"
@ -38,18 +38,16 @@
},
"devDependencies": {
"ava": "^0.22.0",
"cxs": "^6.0.0",
"cxs": "^6.1.0",
"isomorphic-fetch": "^2.2.1",
"nyc": "^11.2.1",
"refunk": "^2.0.0-1"
},
"x0": {
"title": "X0",
"count": 32,
"basename": "/docs",
"title": "Compositor x0",
"basename": "/x0",
"routes": [
"/",
"debug"
"/"
]
},
"ava": {
@ -58,7 +56,9 @@
"!test/components",
"!test/output"
],
"require": [ "babel-register" ],
"require": [
"babel-register"
],
"babel": {
"presets": [
"env",