visual tweaks to the preview card and added context in a comment regarding dufflepud

This commit is contained in:
Andrew 2023-03-28 06:11:21 -04:00 committed by Kieran
parent 9ab702b846
commit 3ceb83b318
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 25 additions and 4 deletions

View File

@ -1,6 +1,10 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
async function fetchUrlPreviewInfo(url: string) { async function fetchUrlPreviewInfo(url: string) {
// Hardcoded the dufflepud url here only for initial testing by Snort devs,
// will be more ideal for Snort to deploy its own instance of Dufflepud
// and link to it in an .env to not bombard dufflepud.onrender.com , which is
// Coracle's instance. Repo: https://github.com/staab/dufflepud
const res = await fetch("http://dufflepud.onrender.com/link/preview", { const res = await fetch("http://dufflepud.onrender.com/link/preview", {
method: "POST", method: "POST",
body: JSON.stringify({ url }), body: JSON.stringify({ url }),
@ -31,10 +35,12 @@ const LinkPreview = ({ url }: { url: string }) => {
.catch(console.error); .catch(console.error);
}, [url]); }, [url]);
return ( return (
<a href={url}> <div className="link-preview-container">
<img src={previewImage}></img> <a href={url}>
<p>{previewtitle}</p> <img src={previewImage} className="link-preview-image"></img>
</a> <p className="link-preview-title">{previewtitle}</p>
</a>
</div>
); );
}; };

View File

@ -231,3 +231,18 @@
.close-menu-container { .close-menu-container {
position: absolute; position: absolute;
} }
.link-preview-container {
border: 1px solid #282828;
border-radius: 10px;
}
.link-preview-title {
padding-left: 10px;
padding-right: 10px;
padding-bottom: 10px;
}
.link-preview-image {
margin: 0 0 15px 0 !important;
}