-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
703 additions
and
636 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
["preact-cli/babel", { "modules": "commonjs" }] | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,34 @@ | ||
import { h, Component } from 'preact'; | ||
import { Router } from 'preact-router'; | ||
|
||
import Header from './header'; | ||
import NavBar from './navbar' | ||
import Footer from './footer' | ||
import Home from '../routes/home'; | ||
import Demos from '../routes/demos'; | ||
import { Component } from 'preact' | ||
import { Router } from 'preact-router' | ||
|
||
// import Home from 'async!../routes/home'; | ||
// import Profile from 'async!../routes/profile'; | ||
|
||
if (module.hot) { | ||
require('preact/debug'); | ||
} | ||
// Code-splitting is automated for routes | ||
import Home from '../routes/home' | ||
import Profile from '../routes/profile' | ||
import Navbar from './navbar' | ||
|
||
export default class App extends Component { | ||
/** Gets fired when the route changes. | ||
* @param {Object} event "change" event from [preact-router](http://git.io/preact-router) | ||
* @param {string} event.url The newly routed URL | ||
/** | ||
* Gets fired when the route changes. | ||
* @param {Object} event "change" event from [preact-router](http://git.io/preact-router) | ||
* @param {string} event.url The newly routed URL | ||
*/ | ||
handleRoute = e => { | ||
this.currentUrl = e.url; | ||
this.currentUrl = e.url | ||
}; | ||
|
||
render() { | ||
render () { | ||
return ( | ||
<div> | ||
<Header /> | ||
<NavBar /> | ||
<Router onChange={this.handleRoute}> | ||
<Home path="/" /> | ||
<Demos path="/demos" /> | ||
</Router> | ||
<Footer /> | ||
<div id='app'> | ||
<Navbar /> | ||
<div id='content'> | ||
<Router onChange={this.handleRoute}> | ||
<Home path='/' /> | ||
<Profile path='/profile/' user='me' /> | ||
<Profile path='/profile/:user' /> | ||
</Router> | ||
</div> | ||
</div> | ||
) | ||
/* | ||
return ( | ||
<div id="app"> | ||
<Header /> | ||
<Router onChange={this.handleRoute}> | ||
<Home path="/" /> | ||
<Profile path="/profile/" user="me" /> | ||
<Profile path="/profile/:user" /> | ||
</Router> | ||
</div> | ||
);*/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component } from 'preact' | ||
import style from './style' | ||
|
||
const hljsPromise = Promise.all([ | ||
import('highlight.js/lib/highlight'), | ||
import('highlight.js/lib/languages/javascript') | ||
]).then(([hljs, javascript]) => { | ||
hljs.registerLanguage('javascript', javascript) | ||
return hljs | ||
}) | ||
|
||
export default class Livecode extends Component { | ||
componentDidMount () { | ||
hljsPromise.then(hljs => { | ||
hljs.highlightBlock(this.base) | ||
}) | ||
} | ||
render ({ code }) { | ||
return ( | ||
<pre class={style.code}><code class='javascript'>{code}</code></pre> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
.code { | ||
width: 100%; | ||
} |
File renamed without changes.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Component } from 'preact' | ||
import style from './style' | ||
|
||
const hljsPromise = Promise.all([ | ||
import('highlight.js/lib/highlight'), | ||
import('highlight.js/lib/languages/javascript') | ||
]).then(([hljs, javascript]) => { | ||
hljs.registerLanguage('javascript', javascript) | ||
return hljs | ||
}) | ||
|
||
export default class Livecode extends Component { | ||
componentDidMount () { | ||
hljsPromise.then(hljs => { | ||
hljs.highlightBlock(this.base.childNodes[0]) | ||
}) | ||
} | ||
render ({ code }) { | ||
return ( | ||
<div class={style.livecode}> | ||
<pre class={style.codearea}><code class='javascript'>{code}</code></pre> | ||
<div class={style.consolearea} /> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
.livecode { | ||
height: 300px; | ||
width: 100%; | ||
} | ||
|
||
.codearea { | ||
background-color: var(--background-color); | ||
height: 30px; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Component } from 'preact' | ||
import style from './style' | ||
|
||
export default class Navbar extends Component { | ||
// Note: `user` comes from the URL, courtesy of our router | ||
render () { | ||
return ( | ||
<nav class={style.navbar}> | ||
<ol> | ||
<li><a href='bikes'>Bikes</a></li> | ||
<li><a href='bikes/bmx'>BMX</a></li> | ||
</ol> | ||
</nav> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
.navbar ol { | ||
list-style: none; | ||
margin: 4rem 0 0 0; | ||
padding: 0; | ||
} | ||
|
||
.navbar a { | ||
padding-left: 3rem; | ||
color: var(--navbar-color); | ||
text-decoration: none; | ||
display: block; | ||
line-height: 2rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
import style from './style' | ||
|
||
const Textcontent = ({ children }) => ( | ||
<div class={style.textcontent}> | ||
{ children } | ||
</div> | ||
) | ||
|
||
export default Textcontent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
.textcontent { | ||
max-width: 50rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import './style' | ||
import './style/highlightjs.css' | ||
|
||
import App from './components/app' | ||
|
||
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.