import useWindowDimensions from "~/hooks/windowDimensions";
import trimLink from "~/functions/trimLink";

export  default function NameField ({name, isLink} : {name: string|undefined, isLink: boolean} ) {
    if (!name){
        return (<p>???</p>)
    }
    const { width } = useWindowDimensions();
    if (isLink){
        return (
            <a href={name} target="_blank" className="title-header-link">{width < 570 ? trimLink(name) : name}</a>
        )
    } else {
        return (
            <p>{width < 570 ? trimLink(name) : name}</p>
        )
    }
}