Files
reminder-bot/reminder-dashboard/src/components/Sidebar/GuildEntry.tsx
2024-04-07 20:20:16 +01:00

29 lines
720 B
TypeScript

import { GuildInfo } from "../../api";
import { Link, useLocation } from "wouter";
type Props = {
guild: GuildInfo;
};
export const GuildEntry = ({ guild }: Props) => {
const [loc] = useLocation();
const currentId = loc.match(/^\/(?<id>\d+)/);
return (
<li>
<Link
class={
currentId !== null && guild.id === currentId.groups.id
? "is-active switch-pane"
: "switch-pane"
}
href={`/${guild.id}/reminders`}
>
<>
<span class="guild-name">{guild.name}</span>
</>
</Link>
</li>
);
};