app/components/filter-link.tsx
27 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| FilterLink | 6 to 28 | 4 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
Imports
It imports app/lib/inter-width.ts. Imported by app/routes/blog._index.tsx.
Source
import type { CSSProperties } from "react";
import { Link } from "react-router";
import { interWidthEm } from "~/lib/inter-width";
/** One link in a `.list-filter` row: its name box is Inter's width, whichever face draws it. */
export function FilterLink({
to,
label,
count,
active,
title,
}: {
to: string;
label: string;
count?: number;
active: boolean;
title?: string;
}) {
const width = { "--name-w": `${interWidthEm(label, active ? 600 : 400)}em` } as CSSProperties;
return (
<Link to={to} aria-current={active ? "true" : undefined} title={title}>
<span className="filter-name" style={width}>
{label}
</span>
{count === undefined ? null : <span className="filter-count">{count}</span>}
</Link>
);
}