feat: add some more titles

This commit is contained in:
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>