Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hovering effect added on recepies #343

Merged
merged 5 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ const allowedOrigins = [
/https:\/\/deploy-preview-\d+--delightful-daifuku-a9f6ea\.netlify\.app/,
];


app.use(
cors({
origin: function (origin, callback) {
// Allow requests with no `origin` (like from Postman or server-side scripts)
if (!origin || allowedOrigins.some((o) =>
typeof o === "string" ? o === origin : o.test(origin)
)) {
callback(null, true);
} else {
// Provide a more informative error message if necessary
callback(new Error("CORS policy: This origin is not allowed."));
}
},
})
);

// app.use(cors({origin:"http://localhost:5173"})) // for local use

INam1995 marked this conversation as resolved.
Show resolved Hide resolved
app.use(
cors({
origin: function (origin, callback) {
Expand All @@ -42,6 +61,7 @@ app.use(

// app.use(cors({ origin: "http://localhost:5173" })) // for local use


const collectDefaultMetrics = client.collectDefaultMetrics;

collectDefaultMetrics({ register: client.register });
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/Components/Cards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ const Cards = ({ dish, setRecipes, recipes, index }) => {
};

return (
<div className="p-4">
<div className="border-2 border-gray-200 border-opacity-60 rounded-lg overflow-hidden">

<div className="p-4 cursor-pointer" onClick={handleClick}>
<div className="border-2 border-gray-200 border-opacity-60 rounded-lg overflow-hidden transform transition-transform duration-300 ease-in-out hover:scale-105 hover:shadow-lg">
<img
className="lg:h-48 md:h-36 w-full object-cover object-center cursor-pointer"
src={dish.image}
Expand Down Expand Up @@ -185,7 +186,7 @@ const Cards = ({ dish, setRecipes, recipes, index }) => {
};

Cards.propTypes = {
dish: PropTypes.object.isRequired,
dish: PropTypes.object.isRequired
};

export default Cards;
export default Cards;
5 changes: 3 additions & 2 deletions frontend/src/Pages/OneRecipe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useEffect } from "react";
import React, { useState } from "react";
import { useLocation, useNavigate, useParams } from "react-router-dom";
import axios from "axios";

import { MdDelete } from "react-icons/md";


Expand Down Expand Up @@ -119,10 +120,10 @@ const OneRecipe = () => {
)
}
return (
<div className="w-[80vw] m-auto my-12">
<div className="w-[80vw] m-auto my-12 ">
<h1 className="text-3xl font-extrabold text-red-700 my-8 text-center">{recipe.name}</h1>
<form>
<div className="md:grid md:grid-cols-[50%_50%] space-x-4">
<div className="md:grid md:grid-cols-[50%_50%] space-x-4 image">
<input
type="image"
src={recipe.image}
Expand Down
Loading