diff options
author | Vitaly Takmazov | 2018-06-09 15:50:47 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:52 +0300 |
commit | 733343545f2be35f192011f2741dc8c41948cac8 (patch) | |
tree | ba1d4fef36529965b1344f2016e312ad2269816a /vnext/src/index.js | |
parent | 4e744b4ac064133d36f75799139607508e1cb8d1 (diff) |
many updates
Diffstat (limited to 'vnext/src/index.js')
-rw-r--r-- | vnext/src/index.js | 70 |
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')); |