diff --git a/frontend/src/App.css b/frontend/src/App.css index f11b456..76e0d16 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -29,7 +29,15 @@ @apply text-gray-600; } - /* background */ + + /* errors */ + .error-text { + @apply text-sm text-red-600; + } + + /* @todo replace by components! + +/* background */ .app-bg { @apply flex items-center w-screen justify-center min-h-screen bg-gray-50; } @@ -42,15 +50,6 @@ @apply p-6 max-w-2xl mx-auto; } - /* errors */ - .error-text { - @apply text-sm text-red-600; - } - - /* @todo replace by components! - .horizontal-input-group { - @apply flex gap-2 mb-2 items-center; - } /* containers */ .circular-container { diff --git a/frontend/src/components/basics/HorizontalInputGroupLayout.tsx b/frontend/src/components/basics/HorizontalInputGroupLayout.tsx new file mode 100644 index 0000000..a32cce6 --- /dev/null +++ b/frontend/src/components/basics/HorizontalInputGroupLayout.tsx @@ -0,0 +1,29 @@ +import type {ReactNode} from "react"; +import clsx from "clsx"; + +type HorizontalInputGroupLayoutProps = { + /** Content to render inside the header */ + children: ReactNode; + + /** Optional additional Tailwind classes */ + className?: string; +}; + +/** + * A layout for horizontally aligning inputs and buttons - designed for pages with several input items in a row + * @param children Children of the layout, i.e., inputs + * @param className Optional additional styles + * @constructor + */ +export default function HorizontalInputGroupLayout({children, className = ""}: HorizontalInputGroupLayoutProps) { + return ( +
+ {children} +
+ ); +} \ No newline at end of file diff --git a/frontend/src/components/recipes/IngredientGroupListItem.tsx b/frontend/src/components/recipes/IngredientGroupListItem.tsx index 88e44bc..8a7a1cd 100644 --- a/frontend/src/components/recipes/IngredientGroupListItem.tsx +++ b/frontend/src/components/recipes/IngredientGroupListItem.tsx @@ -3,6 +3,7 @@ import {ButtonType} from "../basics/BasicButtonDefinitions.ts"; import {IngredientListEditor} from "./IngredientListEditor.tsx"; import type {IngredientGroupModel} from "../../models/IngredientGroupModel.ts"; import type {IngredientModel} from "../../models/IngredientModel.ts"; +import HorizontalInputGroupLayout from "../basics/HorizontalInputGroupLayout.tsx"; type IngredientGroupListItemProps = { /** The list item's index */ @@ -33,7 +34,7 @@ export default function IngredientGroupListItem({ } return (
-
+ -
+ updateIngredientList(index, list)} diff --git a/frontend/src/components/recipes/IngredientListEditor.tsx b/frontend/src/components/recipes/IngredientListEditor.tsx index b7f4df6..21ebecb 100644 --- a/frontend/src/components/recipes/IngredientListEditor.tsx +++ b/frontend/src/components/recipes/IngredientListEditor.tsx @@ -2,6 +2,7 @@ import {Plus, X} from "lucide-react" import type {IngredientModel} from "../../models/IngredientModel" import Button from "../basics/Button" import {ButtonType} from "../basics/BasicButtonDefinitions" +import HorizontalInputGroupLayout from "../basics/HorizontalInputGroupLayout.tsx"; type IngredientListEditorProps = { @@ -54,7 +55,7 @@ export function IngredientListEditor({ingredients, onChange}: IngredientListEdit return (
{ingredients.map((ing, index) => ( -
+ -
+ ))}