8000 linksf/pages/home/index.js at linkyeg · ideaOwl/linksf · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 944 Bytes

index.js

File metadata and controls

43 lines (34 loc) · 944 Bytes
import React, { Component } from 'react'
import globalConfig from '../../config'
import icons from '../../icons/css/fontello.css'
import { fetchTaxonomies } from '../../core/firebaseRestAPI'
import { taxonomiesWithIcons } from '../../lib/taxonomies'
import Home from '../../components/Home'
import Layout from '../../components/Layout'
import Loading from '../../components/Loading'
class HomePage extends Component {
constructor(props) {
super(props)
this.state = {
taxonomies: [],
}
}
componentDidMount() {
fetchTaxonomies()
.then(taxonomies => {
this.setState({
taxonomies: taxonomiesWithIcons(taxonomies)
})
})
document.title = globalConfig.title
}
render() {
const { taxonomies } = this.state
return (
<Layout>
{ taxonomies.length ? <Home categories={taxonomies} /> : <Loading /> }
</Layout>
)
}
}
export default HomePage
0