-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.js
52 lines (44 loc) · 1.7 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from 'react'
import axios from 'axios'
import './styles/App.scss'
import StoriesFeed from './components/StoriesFeed'
import DiscussionsFeed from './components/DiscussionFeed'
const baseURL = 'https://hashnode.com'
const browserType = process.env.browser || 'chrome'
const utmVal = (browserType === 'chrome') ? 'chrome_extension' : 'FF_extension'
class App extends React.Component {
constructor(props) {
super(props)
this.page = 0
this.state = {
context: 'trending',
posts: [],
isLoading: false
}
}
render() {
return (
<div id='app'>
<div className='header'>
<a href={`https://hashnode.com?utm_source=${utmVal}&utm_medium=extension`} className='logo' target='_blank'>
<img src={require('./images/hn-logo.png')} />
</a>
<div className='nav'>
<button className={this.state.context === 'trending' ? 'active' : ''} onClick={() => this.setState({ context: 'trending' })}> Stories </button>
<button className={this.state.context === 'hot' ? 'active' : ''} onClick={() => this.setState({ context: 'hot' })}> Discussions </button>
</div>
</div>
<div className='content'>
{ this.state.context === 'trending'? <StoriesFeed/> : <DiscussionsFeed/> }
</div>
<div className='footer'>
<div>
<a href={`https://hashnode.com?utm_source=${utmVal}&utm_medium=extension`} target='_blank' rel='noopener'>My feed</a> · <span>© {new Date().getFullYear()}</span>
</div>
<a href='https://github.com/Hashnode/user-feedback' target='_blank' rel='noopener'>Feedback</a>
</div>
</div>
)
}
}
export default App