import { Handlers, PageProps } from "$fresh/server.ts"; import { MainLayout } from "@components/layouts/main.tsx"; import { getAllRecipes, Recipe } from "@lib/resource/recipes.ts"; import { Grid } from "@components/Grid.tsx"; import { IconArrowLeft } from "@components/icons.tsx"; import { KMenu } from "@islands/KMenu.tsx"; import { RedirectSearchHandler } from "@islands/Search.tsx"; import { parseResourceUrl, searchResource } from "@lib/search.ts"; import { GenericResource } from "@lib/types.ts"; import { ResourceCard } from "@components/Card.tsx"; export const handler: Handlers< { recipes: Recipe[] | null; searchResults?: GenericResource[] } > = { async GET(req, ctx) { const recipes = await getAllRecipes(); const searchParams = parseResourceUrl(req.url); const searchResults = searchParams && await searchResource({ ...searchParams, types: ["recipe"] }); return ctx.render({ recipes, searchResults }); }, }; export default function Greet( props: PageProps< { recipes: Recipe[] | null; searchResults: GenericResource[] } >, ) { const { recipes, searchResults } = props.data; return (
Back

🍽️ Recipes

{recipes?.map((doc) => { return ; })}
); }