mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
added Board context
This commit is contained in:
+12
-8
@@ -6,6 +6,7 @@ import Board from './components/Board';
|
||||
import Thread from './components/Thread';
|
||||
import { createGlobalStyle } from 'styled-components';
|
||||
|
||||
export const BoardContext = React.createContext();
|
||||
|
||||
const GlobalStyle = createGlobalStyle`
|
||||
body {
|
||||
@@ -17,13 +18,16 @@ const GlobalStyle = createGlobalStyle`
|
||||
}
|
||||
`;
|
||||
|
||||
function App() {
|
||||
export default function App() {
|
||||
const [bodyStyle, setBodyStyle] = useState({
|
||||
background: "#ffe url(/fade.png) top repeat-x",
|
||||
color: "maroon",
|
||||
fontFamily: "Helvetica, Arial, sans-serif"
|
||||
});
|
||||
|
||||
const [selectedTitle, setSelectedTitle] = useState('');
|
||||
const [selectedAddress, setSelectedAddress] = useState('');
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Helmet>
|
||||
@@ -40,12 +44,12 @@ function App() {
|
||||
color={bodyStyle.color}
|
||||
fontFamily={bodyStyle.fontFamily}
|
||||
/>
|
||||
<Routes>
|
||||
<Route path='/' element={<Home />} />
|
||||
<Route path='/board' element={<Board setBodyStyle={setBodyStyle} />} />
|
||||
<Route path='/board/:thread' element={<Thread />} />
|
||||
</Routes>
|
||||
<BoardContext.Provider value={{ selectedTitle, setSelectedTitle, selectedAddress, setSelectedAddress }}>
|
||||
<Routes>
|
||||
<Route path='/' element={<Home />} />
|
||||
<Route path='/board' element={<Board setBodyStyle={setBodyStyle} />} />
|
||||
<Route path='/board/:thread' element={<Thread />} />
|
||||
</Routes>
|
||||
</BoardContext.Provider>
|
||||
</div>
|
||||
)}
|
||||
|
||||
export default App;
|
||||
|
||||
Reference in New Issue
Block a user