header param

This commit is contained in:
smolgrrr 2024-08-13 16:43:33 +10:00
parent 553459afe8
commit 11628443cf

View File

@ -3,17 +3,23 @@ import {
BellIcon, BellIcon,
HashtagIcon HashtagIcon
} from "@heroicons/react/24/outline"; } from "@heroicons/react/24/outline";
import { useLocation } from "react-router-dom";
export default function Header() { export default function Header() {
const location = useLocation();
const pathParts = location.pathname.split('/');
const secondLastPart = pathParts[pathParts.length - 2];
const lastPathPart = secondLastPart === "thread" ? "/thread" : "/" + pathParts[pathParts.length - 1];
return ( return (
<header className="mx-auto px-4 sm:px-6 lg:px-8 py-2"> <header className="mx-auto px-4 sm:px-6 lg:px-8 py-2">
<div className="flex justify-between items-center"> <div className="flex justify-between items-center">
<a href="/"> <a href="/">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<img src="/icon.png" className="h-12" alt="logo" /> <img src="/icon.png" className="h-12" alt="logo" />
<span className="font-semibold text-white"> <span className="font-semibold text-white">
{"~\\WIRED>"} {`~/WIRED${lastPathPart}>`}
</span> </span>
</div> </div>
</a> </a>
<div> <div>