diff --git a/components/TabsBar.tsx b/components/TabsBar.tsx index f273592d639d..d2c1dcaa83cd 100644 --- a/components/TabsBar.tsx +++ b/components/TabsBar.tsx @@ -2,24 +2,36 @@ import { LINK_STYLES } from "@/utils/constants.ts"; import { cx } from "@twind/core"; +export function TabItem( + props: { path: string; innerText: string; active: boolean }, +) { + return ( + + {props.innerText} + + ); +} + export default function TabsBar( props: { links: { path: string; innerText: string }[]; currentPath: string }, ) { return (
{props.links.map((link) => ( - - {link.innerText} - + ))}
); diff --git a/routes/index.tsx b/routes/index.tsx index c71d0f4d0419..e948434d92e9 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -14,9 +14,8 @@ import { type User, } from "@/utils/db.ts"; import { DAY, WEEK } from "std/datetime/constants.ts"; -import { getToggledStyles } from "@/utils/display.ts"; -import { ACTIVE_LINK_STYLES, LINK_STYLES } from "@/utils/constants.ts"; import Head from "@/components/Head.tsx"; +import { TabItem } from "@/components/TabsBar.tsx"; interface HomePageData extends State { itemsUsers: User[]; @@ -62,38 +61,23 @@ export const handler: Handlers = { function TimeSelector(props: { url: URL }) { const timeAgo = props.url.searchParams.get("time-ago"); return ( -
+
{/* These links do not preserve current URL queries. E.g. if ?page=2, that'll be removed once one of these links is clicked */} - - Last Week - - - Last Month - - - All time - + + +
); }