import type { UrlCard, Collection } from '@/api-client'; import { getDomain } from '@/lib/utils/link'; import { Card, Image, Text, Stack, Group, Anchor, AspectRatio, Skeleton, Tooltip, } from '@mantine/core'; import Link from 'next/link'; import UrlCardActions from '../urlCardActions/UrlCardActions'; import { MouseEvent, Suspense } from 'react'; import { useRouter } from 'next/navigation'; import styles from './UrlCard.module.css'; interface Props { size?: 'large' | 'compact' | 'small'; id: string; url: string; cardContent: UrlCard['cardContent']; note?: UrlCard['note']; collections?: Collection[]; currentCollection?: Collection; urlLibraryCount: number; urlIsInLibrary?: boolean; authorHandle?: string; } export default function UrlCard(props: Props) { const domain = getDomain(props.url); const router = useRouter(); const handleNavigateToSemblePage = (e: MouseEvent) => { e.stopPropagation(); router.push(`/url?id=${props.cardContent.url}`); }; // TODO: add more sizes return ( e.stopPropagation()} component={Link} href={props.url} target="_blank" c={'gray'} lineClamp={1} > {domain} {props.cardContent.title && ( {props.cardContent.title} )} {props.cardContent.description && ( {props.cardContent.description} )} {props.cardContent.thumbnailUrl && ( {`${props.url} )} } > ); }