feat: display articles
This commit is contained in:
@@ -3,9 +3,8 @@ import type { ImageMetadata } from "astro";
|
||||
import { Picture as AstroImage } from "astro:assets";
|
||||
import { inferRemoteSize } from 'astro/assets/utils';
|
||||
import { generateThumbHash, getExifData } from "@helpers/image";
|
||||
import sharp from "sharp";
|
||||
interface Props {
|
||||
src: ImageMetadata & { fsPath?: string };
|
||||
src: ImageMetadata & { fsPath?: string, src?: string };
|
||||
alt: string;
|
||||
pictureClass?: string;
|
||||
class?: string;
|
||||
@@ -16,7 +15,6 @@ interface Props {
|
||||
}
|
||||
|
||||
async function checkImage(image: ImageMetadata) {
|
||||
console.log("Checking image: ", image);
|
||||
const src = image.src;
|
||||
try {
|
||||
if (src.startsWith("/@fs") || src.startsWith("/_astro")) return true;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
---
|
||||
import * as memorium from "@helpers/memorium";
|
||||
import { markdownToHtml, markdownToText } from "@helpers/markdown";
|
||||
import { markdownToHtml } from "@helpers/markdown";
|
||||
import Image from "@components/Image.astro";
|
||||
import type { ImageMetadata } from "astro";
|
||||
|
||||
const { resource } = Astro.props;
|
||||
const ingredients = resource?.content?.recipeIngredient || [];
|
||||
const instructions = resource?.content?.recipeInstructions || [];
|
||||
---
|
||||
|
||||
<h1 class="text-4xl">{resource?.content?.headline}</h1>
|
||||
@@ -14,7 +13,7 @@ const instructions = resource?.content?.recipeInstructions || [];
|
||||
resource?.content?.image && (
|
||||
<Image
|
||||
hash
|
||||
src={{ src: memorium.getImageUrl(resource.content.image) }}
|
||||
src={{ src: memorium.getImageUrl(resource.content.image) } as ImageMetadata}
|
||||
alt="Cover for {resource?.content?.name}"
|
||||
class="rounded-2xl overflow-hidden"
|
||||
pictureClass="rounded-2xl"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
import * as memorium from "@helpers/memorium";
|
||||
import { markdownToHtml, markdownToText } from "@helpers/markdown";
|
||||
import { markdownToHtml } from "@helpers/markdown";
|
||||
import Image from "@components/Image.astro";
|
||||
import type { ImageMetadata } from "astro";
|
||||
|
||||
const { resource } = Astro.props
|
||||
const ingredients = resource?.content?.recipeIngredient || [];
|
||||
@@ -10,7 +11,7 @@ const instructions = resource?.content?.recipeInstructions || [];
|
||||
|
||||
<h1 class="text-4xl">{resource?.content?.name}</h1>
|
||||
<div>
|
||||
{resource?.content?.image && <Image hash src={{src: memorium.getImageUrl(resource.content.image)}} alt="Cover for {resource?.content?.name}" class="rounded-2xl overflow-hidden" pictureClass="rounded-2xl" />}
|
||||
{resource?.content?.image && <Image hash src={{src: memorium.getImageUrl(resource.content.image)} as ImageMetadata} alt="Cover for {resource?.content?.name}" class="rounded-2xl overflow-hidden" pictureClass="rounded-2xl" />}
|
||||
</div>
|
||||
<p>{resource?.content?.description}</p>
|
||||
<h2 class="text-2xl">Ingredients</h2>
|
||||
|
||||
Reference in New Issue
Block a user