feat: enhance layout of search
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
import { Card } from "@components/Card.tsx";
|
||||
import { Recipe } from "@lib/resource/recipes.ts";
|
||||
import { isLocalImage } from "@lib/string.ts";
|
||||
|
||||
export function RecipeCard({ recipe }: { recipe: Recipe }) {
|
||||
const { meta: { image = "/placeholder.svg" } = {} } = recipe;
|
||||
|
||||
const imageUrl = image.startsWith("Recipes/images/")
|
||||
const imageUrl = isLocalImage(image)
|
||||
? `/api/images?image=${image}&width=200&height=200`
|
||||
: image;
|
||||
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
IconEdit,
|
||||
IconExternalLink,
|
||||
} from "@components/icons.tsx";
|
||||
import { isLocalImage } from "@lib/string.ts";
|
||||
|
||||
export function RecipeHero(
|
||||
{ data, subline, backlink, editLink }: {
|
||||
@ -15,10 +16,9 @@ export function RecipeHero(
|
||||
) {
|
||||
const { meta: { image } = {} } = data;
|
||||
|
||||
const imageUrl =
|
||||
(image?.startsWith("Recipes/images/") || image?.startsWith("Media/movies/"))
|
||||
? `/api/images?image=${image}&width=800`
|
||||
: image;
|
||||
const imageUrl = (image && isLocalImage(image))
|
||||
? `/api/images?image=${image}&width=800`
|
||||
: image;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
@ -14,3 +14,4 @@ export { default as IconLoader2 } from "https://deno.land/x/tabler_icons_tsx@0.0
|
||||
export { default as IconLogin } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/login.tsx";
|
||||
export { default as IconLogout } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/logout.tsx";
|
||||
export { default as IconSearch } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/search.tsx";
|
||||
export { default as IconGhost } from "https://deno.land/x/tabler_icons_tsx@0.0.3/tsx/ghost.tsx";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ComponentChildren } from "preact";
|
||||
import { menu } from "@lib/menus.ts";
|
||||
import { resources } from "@lib/resources.ts";
|
||||
import { CSS, KATEX_CSS } from "https://deno.land/x/gfm@0.2.5/mod.ts";
|
||||
import { Head } from "$fresh/runtime.ts";
|
||||
import Search, { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||
@ -29,7 +29,7 @@ export const MainLayout = ({ children, url, title, context }: Props) => {
|
||||
</Head>
|
||||
<aside class="p-4 hidden md:block">
|
||||
<nav class="min-h-fit rounded-3xl p-3 grid gap-3 fixed t-0">
|
||||
{menu.map((m) => {
|
||||
{Object.values(resources).map((m) => {
|
||||
return (
|
||||
<a
|
||||
href={m.link}
|
||||
@ -37,7 +37,7 @@ export const MainLayout = ({ children, url, title, context }: Props) => {
|
||||
m.link === url.pathname ? "bg-white text-black" : "text-white"
|
||||
} p-3 text-xl w-full rounded-2xl`}
|
||||
>
|
||||
{m.name}
|
||||
{m.emoji} {m.name}
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
|
Reference in New Issue
Block a user