add button link for customized Link looking like a Button

This commit is contained in:
Anika Raemer 2025-09-21 11:01:52 +02:00
parent 9cb5b52ac9
commit ee3ac34e4b
4 changed files with 34 additions and 28 deletions

View file

@ -4,7 +4,8 @@ type ButtonProps = {
onClick: () => void,
icon?: Icon,
text?: string,
buttonType? : ButtonType
buttonType?: ButtonType
className?: string
}
export const ButtonType = {
@ -24,11 +25,17 @@ export const ButtonType = {
export type ButtonType = typeof ButtonType[keyof typeof ButtonType];
export default function Button ({onClick: onClick, icon, text, buttonType = ButtonType.DefaultButton} : ButtonProps){
return(
export default function Button(
{
onClick: onClick,
icon, text,
buttonType = ButtonType.DefaultButton,
className = ""
}: ButtonProps) {
return (
<button
type="button"
className={`basic-button ${buttonType.backgroundColor} ${buttonType.textColor}`}
className={`basic-button ${buttonType.backgroundColor} ${buttonType.textColor} ${className}`}
onClick={onClick}
>
<div className="flex items-center gap-2">

View file

@ -3,6 +3,7 @@ import type { Recipe } from "../../types/recipe"
import { useEffect, useState } from "react"
import { fetchRecipe } from "../../api/recipePoint"
import { getRecipeEditUrl, getRecipeListUrl } from "../../routes"
import ButtonLink from "../basics/ButtonLink"
/**
@ -123,18 +124,16 @@ export default function RecipeDetailPage() {
{/* Action buttons */}
<div className="button-group">
<Link
to={ getRecipeEditUrl(recipe.id) }
<ButtonLink
to={getRecipeEditUrl(recipe.id)}
className="basic-button primary-button-bg primary-button-text"
>
Bearbeiten
</Link>
<Link
text="Bearbeiten"
/>
<ButtonLink
to={getRecipeListUrl()}
className="basic-button default-button-bg default-button-text"
>
Zurueck
</Link>
text="Zurueck"
/>
</div>
</div>

View file

@ -26,7 +26,7 @@ export default function RecipeListToolbar({onSearchStringChanged, onAddClicked,
</div>
<Button
buttonType = {ButtonType.PrimaryButton}
//className="flex-shrink-0"
className="flex-shrink-0"
onClick={onAddClicked}
text = "Add recipe"
/>