feat: add some more titles

This commit is contained in:
max_richter 2023-08-04 23:36:35 +02:00
parent d28536a49f
commit e5d2acc590
4 changed files with 18 additions and 7 deletions

View File

@ -6,9 +6,9 @@ import type {
} from "../lib/recipes.ts"; } from "../lib/recipes.ts";
import { FunctionalComponent } from "preact"; import { FunctionalComponent } from "preact";
type IngredientsProps = { function numberToString(num: number) {
ingredients: Ingredients; return (Math.floor(num * 4) / 4).toString();
}; }
const Ingredient = ( const Ingredient = (
{ ingredient, amount, key = "", portion = 1 }: { { ingredient, amount, key = "", portion = 1 }: {
@ -27,7 +27,8 @@ const Ingredient = (
return ( return (
<tr key={key}> <tr key={key}>
<td class="pr-4 py-2"> <td class="pr-4 py-2">
{finalAmount + (typeof unit === "string" ? unit : "")} {numberToString(finalAmount || 0) +
(typeof unit === "string" ? unit : "")}
</td> </td>
<td class="px-4 py-2">{type}</td> <td class="px-4 py-2">{type}</td>
</tr> </tr>

View File

@ -32,6 +32,7 @@ export type Recipe = {
preparation?: string; preparation?: string;
tags: string[]; tags: string[];
meta?: { meta?: {
time?: string;
link?: string; link?: string;
image?: string; image?: string;
rating?: number; rating?: number;
@ -57,7 +58,7 @@ function parseIngredientItem(listItem: DocumentChild): Ingredient | undefined {
teaSpoon: { teaSpoon: {
short: "TL", short: "TL",
plural: "Tea Spoon", plural: "Tea Spoon",
alternates: ["tl", "TL", "Tsp", "tsp"], alternates: ["tl", "TL", "Tsp", "tsp", "teaspoon"],
}, },
litre: { litre: {
short: "L", short: "L",

View File

@ -15,7 +15,7 @@ export const handler: Handlers<Movie[] | null> = {
export default function Greet(props: PageProps<Movie[] | null>) { export default function Greet(props: PageProps<Movie[] | null>) {
return ( return (
<MainLayout url={props.url}> <MainLayout url={props.url} title="Movies">
<KMenu type="main" context={false} /> <KMenu type="main" context={false} />
<header class="flex gap-4 items-center mb-5 md:hidden"> <header class="flex gap-4 items-center mb-5 md:hidden">
<a <a

View File

@ -19,9 +19,18 @@ export default function Greet(props: PageProps<Recipe>) {
const portion = recipe.meta?.portion; const portion = recipe.meta?.portion;
const amount = useSignal(portion || 1); const amount = useSignal(portion || 1);
const subline = [
recipe?.meta?.time && `Duration ${recipe.meta.time}`,
].filter(Boolean);
return ( return (
<MainLayout url={props.url} title={`Recipes > ${recipe.name}`}> <MainLayout url={props.url} title={`Recipes > ${recipe.name}`}>
<RecipeHero data={recipe} backlink="/recipes" /> <RecipeHero
data={recipe}
backlink="/recipes"
editLink={`https://notes.max-richter.dev/Recipes/${recipe.id}`}
subline={subline}
/>
<div class="px-8 text-white mt-10"> <div class="px-8 text-white mt-10">
<div class="flex items-center gap-8"> <div class="flex items-center gap-8">
<h3 class="text-3xl my-5">Ingredients</h3> <h3 class="text-3xl my-5">Ingredients</h3>