diff --git a/src/sections/Advice/components/AdviceSlip.jsx b/src/sections/Advice/components/AdviceSlip.jsx index e69de29b..e999be6b 100644 --- a/src/sections/Advice/components/AdviceSlip.jsx +++ b/src/sections/Advice/components/AdviceSlip.jsx @@ -0,0 +1,12 @@ + +export default function AdviceSlip({ adviceInfo }) { + + return ( +
+ +

Some Advice

+ {adviceInfo &&

{adviceInfo.slip.advice}

} + +
+ ) +} \ No newline at end of file diff --git a/src/sections/Advice/components/FavouriteSlipsList.jsx b/src/sections/Advice/components/FavouriteSlipsList.jsx index e69de29b..58615afc 100644 --- a/src/sections/Advice/components/FavouriteSlipsList.jsx +++ b/src/sections/Advice/components/FavouriteSlipsList.jsx @@ -0,0 +1,14 @@ + +export default function FavouriteSlipsList({ favouritesList}) { + + return ( +
+

Favourite Advice Slips

+ +
+ ) +} \ No newline at end of file diff --git a/src/sections/Advice/index.jsx b/src/sections/Advice/index.jsx index 0405f11f..58eb0be6 100644 --- a/src/sections/Advice/index.jsx +++ b/src/sections/Advice/index.jsx @@ -1,11 +1,46 @@ +import { useEffect, useState } from "react" +import AdviceSlip from "./components/AdviceSlip" +import FavouriteSlipsList from "./components/FavouriteSlipsList" + function AdviceSection() { + const [advice, setAdvice] = useState() + const [favAdvice, setFavAdvice] = useState([]) + + const fetchAdvice = async () => { + const res = await fetch('https://api.adviceslip.com/advice') + const data = await res.json() + setAdvice(data) + } + + useEffect(() => { + fetchAdvice() + + // fetch('https://api.adviceslip.com/advice') + // .then(res => res.json()) + // .then(data => setAdvice(data)) + }, []) + + function onSaveToFavourites() { + if (advice) { + setFavAdvice(prev => [...prev, advice]) + } + } + return (

Advice Section

-
-
+ + + + + + + +
) } export default AdviceSection + + diff --git a/src/sections/Art/components/ArtList.jsx b/src/sections/Art/components/ArtList.jsx index e69de29b..03baea07 100644 --- a/src/sections/Art/components/ArtList.jsx +++ b/src/sections/Art/components/ArtList.jsx @@ -0,0 +1,25 @@ + +import { useState, useEffect } from "react" +import ArtListItem from "./ArtListItem" + +export default function ArtList() { + + const [artList, setArt] = useState([]) + + useEffect(() => { + + fetch('https://boolean-uk-api-server.fly.dev/art') + .then(res => res.json()) + .then(data => setArt(data)) + + }, []) + + return ( + + ) + +} \ No newline at end of file diff --git a/src/sections/Art/components/ArtListItem.jsx b/src/sections/Art/components/ArtListItem.jsx index e69de29b..d6035d37 100644 --- a/src/sections/Art/components/ArtListItem.jsx +++ b/src/sections/Art/components/ArtListItem.jsx @@ -0,0 +1,19 @@ + +import PublicationHistoryList from "./PublicationHistoryList" + +export default function ArtListItem({ artInfo }) { + + return ( +
  • +
    + +
    + +

    {artInfo.title}

    +

    Artist: {artInfo.artist}

    + + + +
  • + ) +} \ No newline at end of file diff --git a/src/sections/Art/components/PublicationHistoryList.jsx b/src/sections/Art/components/PublicationHistoryList.jsx index d3f5a12f..c7736b5d 100644 --- a/src/sections/Art/components/PublicationHistoryList.jsx +++ b/src/sections/Art/components/PublicationHistoryList.jsx @@ -1 +1,14 @@ +export default function PublicationHistoryList({ history }) { + + return ( + <> +

    Publication History:

    + + + ) +} diff --git a/src/sections/Art/index.jsx b/src/sections/Art/index.jsx index 0c74ffc2..22892748 100644 --- a/src/sections/Art/index.jsx +++ b/src/sections/Art/index.jsx @@ -1,8 +1,15 @@ +import ArtList from "./components/ArtList" + function ArtsSection() { + return (

    Arts Section

    -
    +
    + + + +
    ) } diff --git a/src/sections/Users/components/UsersList.jsx b/src/sections/Users/components/UsersList.jsx index e69de29b..fb9d1f86 100644 --- a/src/sections/Users/components/UsersList.jsx +++ b/src/sections/Users/components/UsersList.jsx @@ -0,0 +1,14 @@ +import UsersListItem from "./UsersListItem" + +export default function UsersList({ contacts }) { + + return ( + + ) +} \ No newline at end of file diff --git a/src/sections/Users/components/UsersListItem.jsx b/src/sections/Users/components/UsersListItem.jsx index e69de29b..2ec333d0 100644 --- a/src/sections/Users/components/UsersListItem.jsx +++ b/src/sections/Users/components/UsersListItem.jsx @@ -0,0 +1,15 @@ + +export default function UsersListItem({ contactInfo }) { + + return ( + <> +
  • + {`${contactInfo.firstName} +

    {`${contactInfo.firstName} ${contactInfo.lastName}`}

    +

    Email: {`${contactInfo.email}`}

    +
  • + + ) +} \ No newline at end of file diff --git a/src/sections/Users/index.jsx b/src/sections/Users/index.jsx index 77332830..41855346 100644 --- a/src/sections/Users/index.jsx +++ b/src/sections/Users/index.jsx @@ -1,9 +1,27 @@ +import { useEffect, useState } from "react" +import UsersList from "./components/UsersList" + function UsersSection() { + const [contacts, setContacts] = useState([]) + + useEffect(() => { + + fetch('https://boolean-uk-api-server.fly.dev/test/contact') + .then(res => res.json()) + .then(data => setContacts(data)) + + }, []) + return (

    Users Section

    -
    +
    + + + +
    + ) }