This commit is contained in:
2025-05-25 14:53:37 +09:00
parent fa547bc62f
commit 41668fa894
8 changed files with 209 additions and 141 deletions
+33 -20
View File
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect, useState } from 'react'
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'
import HomePage from './pages/HomePage'
import TagPage from './pages/TagPage'
@@ -7,28 +7,41 @@ import TagSidebar from './components/TagSidebar'
import PostPage from './pages/PostPage'
import PostDetailPage from './pages/PostDetailPage'
type Tag = { id: number
name: string
category: string }
type Post = { id: number
url: string
title: string
thumbnail: string
tags: Tag[] }
const App = () => {
const [posts, setPosts] = useState<Post[]> ([])
useEffect (() => {
alert ('このサイトはまだ作りかけです!!!!\n出てけ!!!!!!!!!!!!!!!!!!!!')
}, [])
return (
<Router>
<div className="flex flex-col h-screen w-screen">
<TopNav />
<div className="flex flex-1">
<Routes>
<Route path="/posts/:postId" element={<TagSidebar />} />
<Route path="*" element={<TagSidebar />} />
</Routes>
<main className="flex-1 overflow-y-auto p-4">
<Routes>
<Route path="/" element={<PostPage />} />
<Route path="/posts" element={<PostPage />} />
<Route path="/posts/:id" element={<PostDetailPage />} />
<Route path="/tags/:tag" element={<TagPage />} />
</Routes>
</main>
<Router>
<div className="flex flex-col h-screen w-screen">
<TopNav />
<div className="flex flex-1">
<TagSidebar posts={posts} setPosts={setPosts} />
<main className="flex-1 overflow-y-auto p-4">
<Routes>
<Route path="/posts/:id" element={<PostDetailPage posts={posts} setPosts={setPosts} />} />
<Route path="/tags/:tag" element={<TagPage />} />
<Route path="*" element={<PostPage posts={posts} setPosts={setPosts} />} />
</Routes>
</main>
</div>
</div>
</div>
</Router>
)
</Router>)
}
export default App