forked from b00tc4mp/isdi-parttime-202403
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: validate and ingredient data;add hook useMyRecipes;WIP; b00tc4mp…
- Loading branch information
Showing
35 changed files
with
888 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
staff/angel-patino/project/recipebox/src/components/core/Button.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
staff/angel-patino/project/recipebox/src/components/core/Form.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
staff/angel-patino/project/recipebox/src/components/core/Input.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
function Input({ id, type, placeholder }) { | ||
return ( | ||
<input className="Input" id={id} type={type} placeholder={placeholder} /> | ||
<input className="input" id={id} type={type} placeholder={placeholder} /> | ||
) | ||
} | ||
export default Input |
2 changes: 1 addition & 1 deletion
2
staff/angel-patino/project/recipebox/src/components/core/Label.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
staff/angel-patino/project/recipebox/src/components/core/SubmitButton.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
staff/angel-patino/project/recipebox/src/components/core/Text.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
function Text({ children, className }) { | ||
return <p className={`Text ${className}`}>{children}</p> | ||
return <p className={`text ${className}`}>{children}</p> | ||
} | ||
|
||
export default Text |
2 changes: 1 addition & 1 deletion
2
staff/angel-patino/project/recipebox/src/components/core/Thumbnail.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
function Thumbnail({ src }) { | ||
return <img className="Thumbnail" src={src} /> | ||
return <img className="thumbnail" src={src} /> | ||
} | ||
export default Thumbnail |
2 changes: 1 addition & 1 deletion
2
staff/angel-patino/project/recipebox/src/components/core/Time.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
function Time({ children: time }) { | ||
const formattedTime = new Date(time).toLocaleString() | ||
|
||
return <time className="Time">{formattedTime}</time> | ||
return <time className="time">{formattedTime}</time> | ||
} | ||
|
||
export default Time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
staff/angel-patino/project/recipebox/src/hooks/useMyRecipes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { useState, useEffect } from "react" | ||
import logic from "../logic/index.js" | ||
|
||
export function useMyRecipes() { | ||
const [myRecipes, setMyRecipes] = useState([]) | ||
|
||
useEffect(() => { | ||
loadMyRecipes() | ||
}, []) | ||
|
||
const loadMyRecipes = () => { | ||
try { | ||
logic | ||
.getAllRecipes() | ||
.then((recipes) => { | ||
const userId = logic.getUserId() | ||
const userRecipes = recipes.filter((recipe) => recipe.author.id === userId) | ||
setMyRecipes(userRecipes) | ||
}) | ||
.catch((error) => { | ||
console.error(error) | ||
alert(error.message) | ||
}) | ||
} catch (error) { | ||
console.error(error) | ||
alert(error.message) | ||
} | ||
}; | ||
|
||
return myRecipes | ||
} |
Oops, something went wrong.