diff --git a/frontend/src/App.css b/frontend/src/App.css index 0877dae..99574de 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -33,13 +33,13 @@ } /* buttons */ - .primary-button { - @apply bg-blue-300 px-4 py-2 shadow-md rounded-lg hover:bg-blue-400 text-gray-600 whitespace-nowrap - } - .default-button{ @apply bg-gray-300 px-4 py-2 shadow-md rounded-lg hover:bg-gray-400 whitespace-nowrap text-gray-600 - } + }hover:bg-gray-400 + + .primary-button { + @apply bg-blue-300 hover:bg-blue-400 text-gray-600 + } .dark-button{ @apply bg-gray-600 hover:bg-gray-800 text-white shadow-md rounded px-4 py-2 whitespace-nowrap diff --git a/frontend/src/components/basics/Button.tsx b/frontend/src/components/basics/Button.tsx new file mode 100644 index 0000000..3d9b745 --- /dev/null +++ b/frontend/src/components/basics/Button.tsx @@ -0,0 +1,41 @@ +import SvgIcon, { Icon } from "./SvgIcon" + +type ButtonProps = { + onClicked: () => void, + icon?: Icon, + text?: string, + buttonType : ButtonType +} + +export const ButtonType = { + DarkButton: { + textColor: "text-white", + backgroundColor: "bg-gray-600 hover:bg-gray-800" + }, + PrimaryButton: { + textColor: "text-gray-600", + backgroundColor: "bg-blue-300 hover:bg-blue-400" + }, + DefaultButton: { + textColor: "text-gray-600", + backgroundColor: "bg-gray-300 hover:bg-gray-400" + } +} as const; + +export type ButtonType = typeof ButtonType[keyof typeof ButtonType]; + +export default function Button ({onClicked, icon, text, buttonType = ButtonType.DefaultButton} : ButtonProps){ + return( + + ) +} \ No newline at end of file diff --git a/frontend/src/components/basics/SvgIcon.tsx b/frontend/src/components/basics/SvgIcon.tsx index 83ac6b4..8a86c8a 100644 --- a/frontend/src/components/basics/SvgIcon.tsx +++ b/frontend/src/components/basics/SvgIcon.tsx @@ -8,21 +8,23 @@ */ export const Icon = { LookingGlass: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z", - X: "M6 18L18 6M6 6l12 12" + X: "M6 18L18 6M6 6l12 12", + Plus: "M3 12L21 12M12 3L12 21" } as const; export type Icon = typeof Icon[keyof typeof Icon]; type SvgIconProps = { - pathDefinition : string icon : Icon + color?: string // optional stroke color + hoverColor?: string // optional hover color, set to undefined to deactivate hover } -export default function SvgIcon({icon} : SvgIconProps){ +export default function SvgIcon({icon, color="text-gray-400", hoverColor="text-gray-500"} : SvgIconProps){ return ( Ingredient Groups {ingredientGroupList.map((ingGrp, index) => ( -
+
))} -
+ ) +} + +/* + + -
- ) -} \ No newline at end of file +
+ + Add Ingredient Group +
+ */ \ No newline at end of file diff --git a/frontend/src/components/recipes/IngredientListEditor.tsx b/frontend/src/components/recipes/IngredientListEditor.tsx index 7c24ce5..492b15f 100644 --- a/frontend/src/components/recipes/IngredientListEditor.tsx +++ b/frontend/src/components/recipes/IngredientListEditor.tsx @@ -1,4 +1,6 @@ import type { Ingredient } from "../../types/ingredient" +import Button, { ButtonType } from "../basics/Button" +import SvgIcon, { Icon } from "../basics/SvgIcon" /** * Editor for handling the ingredient list @@ -54,17 +56,18 @@ export function IngredientListEditor({ ingredients, onChange }: IngredientListEd className="dark-button" onClick={() => handleRemove(index)} > - ✖ + ))} - +