mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
add preact with webpack
This commit is contained in:
13
webapp/index.html
Normal file
13
webapp/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>PDFer</title>
|
||||
<meta name="application-name" content="PDFer">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root">
|
||||
<div id="app">Loading</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
19
webapp/index.js
Normal file
19
webapp/index.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { render } from 'preact';
|
||||
|
||||
function init() {
|
||||
const App = require('./views').default;
|
||||
render(App, document.getElementById('root'), document.getElementById('app'));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
console.log('for real now');
|
||||
} else {
|
||||
// use preact's devtools
|
||||
require('preact/devtools');
|
||||
// listen for HMR
|
||||
if (module.hot) {
|
||||
module.hot.accept('./views', init);
|
||||
}
|
||||
}
|
||||
BIN
webapp/static/favicon.ico
Executable file
BIN
webapp/static/favicon.ico
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
0
webapp/styles/styles.css
Normal file
0
webapp/styles/styles.css
Normal file
10
webapp/views/components/Header.js
Normal file
10
webapp/views/components/Header.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { h } from 'preact';
|
||||
import { Link } from 'preact-router';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<header className="header">
|
||||
<h1>PDFer</h1>
|
||||
</header>
|
||||
)
|
||||
}
|
||||
13
webapp/views/components/Layout.js
Normal file
13
webapp/views/components/Layout.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { h } from 'preact';
|
||||
import Header from './Header';
|
||||
|
||||
export default function (props) {
|
||||
return (
|
||||
<div id="app">
|
||||
<Header />
|
||||
<div id="content">
|
||||
{ props.children }
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
15
webapp/views/index.js
Normal file
15
webapp/views/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { h } from 'preact'
|
||||
import { Router } from 'preact-router';
|
||||
|
||||
import Home from './pages/Home';
|
||||
import Layout from './components/Layout';
|
||||
import Error404 from './pages/404';
|
||||
|
||||
export default (
|
||||
<Layout>
|
||||
<Router>
|
||||
<Home path="/" />
|
||||
<Error404 default />
|
||||
</Router>
|
||||
</Layout>
|
||||
);
|
||||
10
webapp/views/pages/404.js
Normal file
10
webapp/views/pages/404.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { h } from 'preact';
|
||||
|
||||
export default function (props) {
|
||||
return (
|
||||
<div>
|
||||
<h2>No hope!</h2>
|
||||
<p>Not sure what you desire, but look for somewhere else...</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
11
webapp/views/pages/Home.js
Normal file
11
webapp/views/pages/Home.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { h } from 'preact';
|
||||
|
||||
export default function (props) {
|
||||
return (
|
||||
<div>
|
||||
<h1>Home</h1>
|
||||
<p>This is the home page.</p>
|
||||
<p>Anything is insane</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user