|
|
|
@ -9,12 +9,13 @@ interface Props {
|
|
|
|
|
faviconUrl?: string |
|
|
|
|
} |
|
|
|
|
const WebsiteCard = (props: Props) => { |
|
|
|
|
const faviconUrl = props.faviconUrl; |
|
|
|
|
const faviconUrl = props.faviconUrl |
|
|
|
|
|
|
|
|
|
const [faviconLoaded, setFaviconLoaded] = useState(false) |
|
|
|
|
useEffect(() => { |
|
|
|
|
if (faviconUrl) { |
|
|
|
|
const faviconNode = document.createElement("img") |
|
|
|
|
faviconNode.src = faviconUrl; |
|
|
|
|
faviconNode.src = faviconUrl |
|
|
|
|
faviconNode.onload = () => { |
|
|
|
|
setFaviconLoaded(true) |
|
|
|
|
} |
|
|
|
@ -27,13 +28,15 @@ const WebsiteCard = (props: Props) => {
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div className={s.root}> |
|
|
|
|
{faviconLoaded &&<img className={(s.favicon)} src={faviconUrl} />} |
|
|
|
|
<a target="_blank" className={s.titleLink} href={url}> |
|
|
|
|
{props.title} |
|
|
|
|
</a> |
|
|
|
|
<a target="_blank" className={s.miniLink} href={url}> |
|
|
|
|
{cleanUrlForUi(props.url)} |
|
|
|
|
</a> |
|
|
|
|
<div className={s.faviconAndUrlWrapper}> |
|
|
|
|
{faviconLoaded && <img className={s.favicon} src={faviconUrl} />} |
|
|
|
|
<a target="_blank" className={s.miniLink} href={url}> |
|
|
|
|
{cleanUrlForUi(props.url)} |
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
<div className={s.description}>{props.description}</div> |
|
|
|
|
</div> |
|
|
|
|
) |
|
|
|
|