diff --git a/src/App.jsx b/src/App.jsx
index 5ef8293f..26b2b3fb 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -13,4 +13,4 @@ function App() {
)
}
-export default App
+export default App;
diff --git a/src/sections/Advice/components/AdviceSlip.jsx b/src/sections/Advice/components/AdviceSlip.jsx
index e69de29b..0d2ad541 100644
--- a/src/sections/Advice/components/AdviceSlip.jsx
+++ b/src/sections/Advice/components/AdviceSlip.jsx
@@ -0,0 +1,41 @@
+import { useEffect, useState } from 'react'
+
+function AdviceSlip({ onAddToFavourites }) {
+
+ const url = "https://api.adviceslip.com/advice";
+ const [data, setData] = useState([]);
+
+ // had to move it outside the useEffect to use it in button for get more advice
+ const fetchData = async () => {
+
+ const response = await fetch(url);
+ const jsonData = await response.json();
+ setData(jsonData.slip);
+ };
+
+ useEffect(() => {
+
+ fetchData();
+ }, [])
+
+ return (
+ <>
+
+
+ Some advice!
+
+
+ {data.advice}
+
+
+
+
+ >
+ )
+}
+
+export default AdviceSlip;
\ No newline at end of file
diff --git a/src/sections/Advice/components/FavouriteSlipsList.jsx b/src/sections/Advice/components/FavouriteSlipsList.jsx
index e69de29b..f5134279 100644
--- a/src/sections/Advice/components/FavouriteSlipsList.jsx
+++ b/src/sections/Advice/components/FavouriteSlipsList.jsx
@@ -0,0 +1,12 @@
+function FavouriteSlipsList({ favourites }) {
+
+ return (
+
+ {(favourites || []).map((slip) => (
+ - {slip.advice}
+ ))}
+
+ );
+}
+
+export default FavouriteSlipsList;
\ No newline at end of file
diff --git a/src/sections/Advice/index.jsx b/src/sections/Advice/index.jsx
index 0405f11f..24ced464 100644
--- a/src/sections/Advice/index.jsx
+++ b/src/sections/Advice/index.jsx
@@ -1,11 +1,27 @@
+import { useState } from 'react'
+
+import AdviceSlip from './components/AdviceSlip';
+import FavouriteSlipsList from './components/FavouriteSlipsList';
+
function AdviceSection() {
+
+ const [favourites, setFavourites] = useState([]);
+
+ const addFavourite = (advice) => {
+ if (!favourites.some((favourites) => favourites.id === advice.id)) {
+ setFavourites((it) => [...it, advice]);
+ }
+ };
+
return (
)
}
-export default AdviceSection
+export default AdviceSection;
diff --git a/src/sections/Art/components/ArtList.jsx b/src/sections/Art/components/ArtList.jsx
index e69de29b..d4e8d97e 100644
--- a/src/sections/Art/components/ArtList.jsx
+++ b/src/sections/Art/components/ArtList.jsx
@@ -0,0 +1,33 @@
+import { useEffect, useState } from 'react'
+
+import ArtListItem from "./ArtListItem";
+
+function ArtList() {
+
+ const url = "https://boolean-uk-api-server.fly.dev/art";
+ const [data, setData] = useState([]);
+
+ useEffect(() => {
+
+ const fetchData = async () => {
+
+ const response = await fetch(url);
+ const jsonData = await response.json();
+ setData(jsonData);
+ };
+
+ fetchData();
+ }, [])
+
+ return (
+
+
+ {data.map((art, index) => (
+
+ ))}
+
+
+ );
+}
+
+export default ArtList;
\ No newline at end of file
diff --git a/src/sections/Art/components/ArtListItem.jsx b/src/sections/Art/components/ArtListItem.jsx
index e69de29b..c35d6793 100644
--- a/src/sections/Art/components/ArtListItem.jsx
+++ b/src/sections/Art/components/ArtListItem.jsx
@@ -0,0 +1,30 @@
+import PublicationHistoryList from "./PublicationHistoryList";
+
+function ArtListItem({ art }) {
+
+ const baseURL = "https://boolean-uk-api-server.fly.dev";
+
+ return (
+ <>
+
+
+ {art.imageURL ? (
+

+ ) : (
+ "No patch"
+ )}
+
+ {art.title}
+ {art.artist}
+ {}
+
+ >
+ )
+}
+
+export default ArtListItem;
\ No newline at end of file
diff --git a/src/sections/Art/components/PublicationHistoryList.jsx b/src/sections/Art/components/PublicationHistoryList.jsx
index d3f5a12f..f32b18c3 100644
--- a/src/sections/Art/components/PublicationHistoryList.jsx
+++ b/src/sections/Art/components/PublicationHistoryList.jsx
@@ -1 +1,14 @@
+function PublicationHistoryList({ publication }) {
+ return (
+ <>
+
+ {publication.map((description, index) => (
+ - {description}
+ ))}
+
+ >
+ )
+}
+
+export default PublicationHistoryList;
\ No newline at end of file
diff --git a/src/sections/Art/index.jsx b/src/sections/Art/index.jsx
index 0c74ffc2..29daec47 100644
--- a/src/sections/Art/index.jsx
+++ b/src/sections/Art/index.jsx
@@ -1,10 +1,15 @@
+import ArtList from "./components/ArtList"
+
function ArtsSection() {
return (
)
}
-export default ArtsSection
+export default ArtsSection;
diff --git a/src/sections/Users/components/UsersList.jsx b/src/sections/Users/components/UsersList.jsx
index e69de29b..02929780 100644
--- a/src/sections/Users/components/UsersList.jsx
+++ b/src/sections/Users/components/UsersList.jsx
@@ -0,0 +1,33 @@
+import { useEffect, useState } from 'react'
+
+import UsersListItem from './UsersListItem';
+
+function UsersList() {
+
+ const url = "https://boolean-uk-api-server.fly.dev/mariehhansen/contact"
+ const [data, setData] = useState([]);
+
+ useEffect(() => {
+
+ const fetchData = async () => {
+
+ const response = await fetch(url);
+ const jsonData = await response.json();
+ setData(jsonData);
+ };
+
+ fetchData();
+ }, [])
+ return (
+
+
+ {data.map((user, index) => (
+
+ ))}
+
+
+
+ )
+}
+
+export default UsersList;
\ No newline at end of file
diff --git a/src/sections/Users/components/UsersListItem.jsx b/src/sections/Users/components/UsersListItem.jsx
index e69de29b..3fef70bb 100644
--- a/src/sections/Users/components/UsersListItem.jsx
+++ b/src/sections/Users/components/UsersListItem.jsx
@@ -0,0 +1,25 @@
+function UsersListItem({ user }) {
+
+ return (
+ <>
+
+
+ {user.profileImage ? (
+

+ ) : (
+ "No profile image"
+ )}
+
+ {(user.gender === "Male") ? (
+ "Mr. " + user.firstName + " " + user.lastName
+ ) : ("Mrs. " + user.firstName + " " + user.lastName)}
+ {"Email: " + user.email}
+
+ >
+ );
+}
+
+export default UsersListItem;
\ No newline at end of file
diff --git a/src/sections/Users/index.jsx b/src/sections/Users/index.jsx
index 77332830..16af794c 100644
--- a/src/sections/Users/index.jsx
+++ b/src/sections/Users/index.jsx
@@ -1,10 +1,14 @@
+import UsersList from "./components/UsersList"
+
function UsersSection() {
return (
)
}
-export default UsersSection
+export default UsersSection;