#7 ぼちぼち

This commit is contained in:
2025-05-18 05:57:48 +09:00
parent 3b172e44d8
commit 2d6986d421
38 changed files with 2408 additions and 15068 deletions
+39
View File
@@ -0,0 +1,39 @@
import React, { useEffect, useState } from 'react'
import axios from 'axios'
import { Link } from 'react-router-dom'
import { API_BASE_URL } from '../config'
const TagSidebar: React.FC = () => {
const [tags, setTags] = useState<Array<{ id: number, name: string }>>([])
useEffect(() => {
const fetchTags = async () => {
try {
const response = await axios.get (`${API_BASE_URL}/tags`)
setTags(response.data)
} catch (error) {
console.error('Failed to fetch tags:', error)
}
}
fetchTags()
}, [])
return (
<div className="w-64 bg-gray-100 p-4 border-r border-gray-200 h-full">
<h2 className="text-xl font-bold mb-4"></h2>
<ul>
{tags.map (tag => (
<li key={tag.id} className="mb-2">
<Link to={`/tags/${tag.id}`} className="text-blue-600 hover:underline">
{tag.name}
</Link>
</li>
))}
</ul>
</div>
)
}
export default TagSidebar
+20
View File
@@ -0,0 +1,20 @@
import React from "react"
const TopNav: React.FC = () => {
return (
<nav className="bg-gray-800 text-white p-3 flex justify-between items-center w-full">
<div className="flex items-center gap-4">
<a href="/" className="text-xl font-bold text-orange-500"> </a>
<a href="/" className="hover:text-orange-500"></a>
<a href="/deerjikists" className="hover:text-orange-500"></a>
<a href="/tags" className="hover:text-orange-500"></a>
<a href="/wiki" className="hover:text-orange-500">Wiki</a>
</div>
<div className="ml-auto pr-4">
<a href="/login" className="hover:text-orange-500"></a>
</div>
</nav>
)
}
export default TopNav