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

View File

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

View File

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

View File

@ -19,9 +19,18 @@ export default function Greet(props: PageProps<Recipe>) {
const portion = recipe.meta?.portion;
const amount = useSignal(portion || 1);
const subline = [
recipe?.meta?.time && `Duration ${recipe.meta.time}`,
].filter(Boolean);
return (
<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="flex items-center gap-8">
<h3 class="text-3xl my-5">Ingredients</h3>