import styles from '../../styles/home/links.module.scss'; import { Category, Link } from '../../types'; export default function Links({ category }: { category: Category; }) { const { name, links } = category; return (

{name} — {links.length}

); } function LinkItem({ link }: { link: Link; }) { const { name, url, category } = link; const { origin, pathname, search } = new URL(url); return (
  • {name} — {category.name}
  • ); } function LinkItemURL({ origin, pathname, search }) { let text = ''; if (pathname !== '/') { text += pathname; } if (search !== '') { if (text === '') { text += '/'; } text += search; } return ( {origin}{text} ) }