1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-01 22:10:04 +09:00
namae/src/App.tsx

36 lines
765 B
TypeScript
Raw Normal View History

2020-08-20 00:57:33 +09:00
import React from 'react'
import { Redirect, Route, Switch } from 'react-router-dom'
import Footer from './components/Footer'
import Home from './pages/Home'
import Search from './pages/Search'
import { GlobalStyle } from './theme'
import { useOpenSearch } from './util/hooks'
import { isStandalone } from './util/pwa'
2019-08-03 00:35:47 +09:00
2019-07-30 23:27:28 +09:00
export default function App() {
2020-08-20 00:57:33 +09:00
const OpenSearch = useOpenSearch('/opensearch.xml')
2020-07-30 13:47:28 +09:00
2020-02-05 15:59:53 +09:00
return (
<>
<GlobalStyle />
2020-07-30 13:47:28 +09:00
<OpenSearch />
2020-02-05 15:59:53 +09:00
<Switch>
2020-02-05 17:28:22 +09:00
<Route exact path="/">
<Home />
</Route>
2020-07-30 13:47:28 +09:00
2020-02-05 15:59:53 +09:00
<Route path="/s/:query">
<Search />
</Route>
2020-07-30 13:47:28 +09:00
2020-02-05 17:28:22 +09:00
<Route path="*">
<Redirect to="/" />
2020-02-05 15:59:53 +09:00
</Route>
</Switch>
2020-07-30 13:47:28 +09:00
{!isStandalone() && <Footer />}
</>
2020-08-20 00:57:33 +09:00
)
2019-07-27 19:18:54 +09:00
}