aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/index.js')
-rw-r--r--vnext/src/index.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/vnext/src/index.js b/vnext/src/index.js
new file mode 100644
index 00000000..97431188
--- /dev/null
+++ b/vnext/src/index.js
@@ -0,0 +1,70 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import { BrowserRouter as Router, Route, Link } from 'react-router-dom';
+import Icon from './components/Icon';
+import Discover from './components/Discover';
+import Post from './components/Post';
+import Thread from './components/Thread';
+import LoginButton from './components/LoginButton';
+
+class App extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ visitor: { uid: 0 }
+ };
+ }
+ render() {
+ return (
+ <Router>
+ <div className="wrapper">
+ <header>
+ <div id="header_wrapper">
+ {this.state.visitor.uid > 0 ?
+ <div id="ctitle">
+ <a href="/{this.state.visitor.name}">
+ <img src="//i.juick.com/a/{this.state.visitor.uid}.png" alt=""/>{this.state.visitor.name}
+ </a>
+ </div>
+ :
+ <div id="logo"><Link to="/">Juick</Link></div>
+ }
+ <div id="search">
+ <form action="/">
+ <input name="search" className="text"
+ placeholder="Search..." />
+ </form>
+ </div>
+ <nav id="global">
+ <ul>
+ {this.state.visitor.uid > 0 ?
+ <li><Link to={{ pathname: '/', search: '?show=discuss'}}><Icon name="ei-comment" size="s"/>Discuss</Link></li>
+ :
+ <li><Link to={{ pathname: '/', search: '?media=1'}} rel="nofollow"><Icon name="ei-camera" size="s"/>Photos</Link></li>
+ }
+ <li><Link to="/" rel="nofollow"><Icon name="ei-search" size="s"/>Discover</Link></li>
+ <li>
+ {this.state.visitor.uid > 0 ?
+ <Link to="post" href="/post"><Icon name="ei-pencil" size="s"/>Post</Link>
+ :
+ <LoginButton title="Login" onAuth={this.auth.bind(this)} />
+ }
+ </li>
+ </ul>
+ </nav>
+ </div>
+ </header>
+ <Route exact path="/" component={Discover} />
+ <Route path="/:user/:mid" component={Thread} />
+ <Route path="/post" component={Post} />
+ </div>
+ </Router>
+ )
+ }
+ auth(data) {
+ console.log(data)
+ }
+}
+
+
+ReactDOM.render(<App />, document.getElementById('wrapper'));