Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
1/2 editor ready
Browse files Browse the repository at this point in the history
  • Loading branch information
HowDoIUseGit committed Jun 11, 2024
1 parent 42d50df commit f5db747
Show file tree
Hide file tree
Showing 7 changed files with 414 additions and 217 deletions.
Binary file modified Cookpit.db
Binary file not shown.
29 changes: 22 additions & 7 deletions frontend/src/components/DisplayRecipe/DisplayRecipe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { BsClock } from "react-icons/bs";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import Modal from "@mui/material/Modal";
import EditIcon from "@mui/icons-material/Edit";
import "./DisplayRecipe.css";
import jsPDF from "jspdf";
//import from favcourite button --> future feature
import icon_heart_black from "../../img/icon_heart_black.png";
import {
Card,
CardMedia,
Expand All @@ -19,9 +18,12 @@ import {
ListItemText,
IconButton,
} from "@mui/material";
import { useNavigate } from "react-router-dom";

type DisplayRecipeProps = {
edit?: boolean;
id_author: number;
id_recipe?: number;
img: string;
title: string;
rating: number;
Expand All @@ -33,6 +35,8 @@ type DisplayRecipeProps = {
};

export default function DisplayRecipe({
edit,
id_recipe,
img,
title,
rating,
Expand Down Expand Up @@ -125,12 +129,14 @@ export default function DisplayRecipe({
};
};

const navigate = useNavigate();

const handleEdit = () => {
navigate(`/rezept/bearbeiten/id/${id_recipe}`);
};

return (
<div id="display_recipe_wrapper">
{/* future feature --> save recieps as favourites --> out of scope for software engineering project */}
{/* <button id="save_to_favourite_recipes">
<img src={icon_heart_black} alt="save to favourites" />
</button> */}
<img onClick={handleOpen} src={img} alt="" />
<div onClick={handleOpen} id="display_recipe_footer">
<div id="recipe_title" className="hover-text">
Expand Down Expand Up @@ -161,7 +167,7 @@ export default function DisplayRecipe({
<IconButton
aria-label="download"
onClick={() => handleDownload(img)}
sx={{ position: "absolute", top: 8, right: 8 }}
sx={{ position: "absolute", top: 2, right: 8 }}
>
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -175,6 +181,15 @@ export default function DisplayRecipe({
<path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708z" />
</svg>
</IconButton>
{edit ? (
<IconButton
aria-label="edit"
onClick={() => handleEdit()}
sx={{ position: "absolute", top: 2, right: 48 }}
>
<EditIcon />
</IconButton>
) : null}
<Card sx={{ maxWidth: 800, margin: "auto", mt: 1 }}>
<CardContent>
<Typography variant="h4" component="div" gutterBottom>
Expand Down
Loading

0 comments on commit f5db747

Please sign in to comment.