Files
5chan/src/App.js
T

60 lines
2.2 KiB
JavaScript
Raw Normal View History

2023-02-08 21:49:36 +01:00
import React, { useState } from 'react';
2023-01-31 23:08:57 +01:00
import { Route, Routes } from 'react-router-dom';
2023-02-01 13:30:32 +01:00
import { Helmet } from 'react-helmet-async';
2023-01-31 23:08:57 +01:00
import Home from './components/Home';
import Board from './components/Board';
2023-02-12 21:20:08 +01:00
import Thread from './components/Thread';
2023-02-08 21:49:36 +01:00
import { createGlobalStyle } from 'styled-components';
2023-02-09 19:08:15 +01:00
export const BoardContext = React.createContext();
2023-02-08 21:49:36 +01:00
const GlobalStyle = createGlobalStyle`
body {
margin: 0;
padding: 0;
background: ${props => props.background};
color: ${props => props.color};
font-family: ${props => props.fontFamily};
}
`;
2023-01-31 23:08:57 +01:00
2023-02-09 19:08:15 +01:00
export default function App() {
2023-02-08 21:49:36 +01:00
const [bodyStyle, setBodyStyle] = useState({
2023-02-16 14:05:48 +01:00
background: "#ffe url(/assets/fade.png) top repeat-x",
2023-02-08 21:49:36 +01:00
color: "maroon",
fontFamily: "Helvetica, Arial, sans-serif"
});
2023-02-09 19:08:15 +01:00
const [selectedTitle, setSelectedTitle] = useState('');
const [selectedAddress, setSelectedAddress] = useState('');
2023-02-13 12:05:10 +01:00
const [selectedStyle, setSelectedStyle] = useState('Yotsuba');
2023-02-09 19:08:15 +01:00
2023-02-01 13:30:32 +01:00
return (
<div>
<Helmet>
2023-02-16 14:05:48 +01:00
<link rel="apple-touch-icon" sizes="180x180" href="/assets/logo/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/assets/logo/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/assets/logo/favicon-16x16.png" />
2023-02-01 13:30:32 +01:00
<link rel="manifest" href="/site.webmanifest" />
<meta name="msapplication-TileColor" content="#fee9cd" />
<meta name="theme-color" content="#ffffff" />
</Helmet>
2023-02-08 21:49:36 +01:00
<GlobalStyle
background={bodyStyle.background}
color={bodyStyle.color}
fontFamily={bodyStyle.fontFamily}
/>
2023-02-13 12:05:10 +01:00
<BoardContext.Provider value={{ selectedTitle, setSelectedTitle, selectedAddress, setSelectedAddress, selectedStyle, setSelectedStyle }}>
2023-02-09 19:08:15 +01:00
<Routes>
2023-02-13 12:05:10 +01:00
<Route exact path='/' element={<Home setBodyStyle={setBodyStyle} />} />
2023-02-11 22:00:13 +01:00
<Route path='/board' element={<Board setBodyStyle={setBodyStyle} />}>
2023-02-12 21:20:08 +01:00
<Route path='post-thread' element={<Board />} />
</Route>
<Route path='/board/thread' element={<Thread setBodyStyle={setBodyStyle} />}>
<Route path='post-reply' element={<Thread />} />
2023-02-11 22:00:13 +01:00
</Route>
2023-02-09 19:08:15 +01:00
</Routes>
</BoardContext.Provider>
2023-02-01 13:30:32 +01:00
</div>
)}