1
0
mirror of https://github.com/byulmaru/quesdon synced 2024-12-01 00:08:05 +09:00

footer and darktheme

This commit is contained in:
rinsuki 2018-01-20 21:14:55 +09:00
parent 9e5de5caf9
commit 9a95fb5055
4 changed files with 47 additions and 4 deletions

View File

@ -14,6 +14,7 @@ import PageMyFollowers from "./pages/my/followers";
import PageBetaHelp from "./pages/beta-help"
import PageNotfound from "./pages/notfound"
import PageMySettings from "./pages/my/settings"
import Footer from "./footer";
interface Props {
userInfo: APIUser | undefined
@ -23,9 +24,9 @@ export default class App extends React.Component<Props> {
render() {
return (
<BrowserRouter>
<div>
<div className="all-container">
<Header userInfo={this.props.userInfo} />
<div className="container mt-2">
<main className="container mt-2">
<Switch>
<Route exact path="/" component={PageIndex}/>
<Route exact path="/latest" component={PageLatest}/>
@ -40,7 +41,8 @@ export default class App extends React.Component<Props> {
<Route exact path="/@:user_id/questions/:question_id" component={PageUserQuestion}/>
<Route component={PageNotfound}/>
</Switch>
</div>
</main>
<Footer />
</div>
</BrowserRouter>
)

View File

@ -0,0 +1,29 @@
import * as React from "react"
import { Link } from "react-router-dom";
import { usingDarkTheme } from "../initial-state";
export default class Footer extends React.Component {
render() {
return <footer className="container">
<p>Quesdon AGPL-3.0 <a href="https://github.com/rinsuki/quesdon"></a></p>
<p>: <a href="https://mstdn.jp/@quesdon">@quesdon@mstdn.jp</a> <Link to="/@quesdon@mstdn.jp">Quesdon ()</Link></p>
<p>: <a href="https://mstdn.maud.io/@rinsuki">@rinsuki@mstdn.maud.io</a></p>
<p>
{usingDarkTheme
? <a href="#" onClick={this.leaveDarkTheme.bind(this)}></a>
: <a href="#" onClick={this.enterDarkTheme.bind(this)}>(β)</a>
}
</p>
</footer>
}
leaveDarkTheme() {
localStorage.removeItem("using-dark-theme")
location.reload()
}
enterDarkTheme() {
localStorage.setItem("using-dark-theme", "1")
location.reload()
}
}

View File

@ -3,4 +3,6 @@ import { APIUser } from "../api-interfaces";
const w = <any>window
export const me: APIUser | undefined = w.USER
export const csrfToken: string = w.CSRFTOKEN
export const csrfToken: string = w.CSRFTOKEN
export const usingDarkTheme: boolean = !!localStorage.getItem("using-dark-theme")

View File

@ -45,4 +45,14 @@
bottom: 0;
left: 0;
right: 0;
}
.all-container {
display:flex;
flex-direction: column;
min-height: 100vh;
}
main {
flex: 1 0 auto;
}