Skip to content
Closed
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
3 changes: 2 additions & 1 deletion src/components/App/App.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Bookings from "@/components/Bookings/Bookings.jsx";
import "./App.scss";

import Deck from "../Deck/Deck";
const App = () => (
<div className="app">
<header className="app__header">
<h1 className="app__heading">CYF Hotel</h1>
</header>
<Bookings />
<Deck />
</div>
);

Expand Down
20 changes: 13 additions & 7 deletions src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
// import "./Card.scss";
import React from "react";
import "./Card.scss";

// const Card = ({ title, url, image }) => {
// return (
const Card = (props) => {
const { title, url, image } = props;
return (
<div className="card">
<h2>{title}</h2>
<img src={image} alt={title} />
<a href={url}> {title}</a>
</div>
);
};

// );
// };

// export default Card;
export default Card;
27 changes: 18 additions & 9 deletions src/components/Deck/Deck.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
// import Card from "@/components/Card/Card";
// import "./Deck.scss";
// import cardsData from "@/data/fakeCards.json";
import Card from "@/components/Card/Card";
import "./Deck.scss";
import cardsData from "@/data/fakeCards.json";

// const Deck = () => {
// you will need to map over the cardsData array and render a Card component for each card object
// how will you pass props to the Card component?
const Deck = (props) => {
return (
<div className="deck">
{cardsData.map((city, index) => (
<Card
key={index}
title={city.title}
url={city.url}
image={city.image}
/>
))}
</div>
);
};

// };

// export default Deck;
export default Deck;
6 changes: 3 additions & 3 deletions src/data/fakeCards.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
{
"title": "Glasgow",
"url": "https://peoplemakeglasgow.com",
"image": "placeholderImage.svg"
"image": "https://2f1a7f9478.visitscotland.net/binaries/content/gallery/visitscotland/cms-images/2023/04/06/queens-park"
},
{
"title": "Manchester",
"url": "https://visitmanchester.com",
"image": "placeholderImage.svg"
"image": "https://media.wired.co.uk/photos/6357b98e09e6f1942a2a8a9a/16:9/w_1920,c_limit/HSBC%20MANCHESTER.jpeg"
},
{
"title": "London",
"url": "https://visitlondon.com",
"image": "placeholderImage.svg"
"image": "https://media.istockphoto.com/id/1347665170/photo/london-at-sunset.jpg?s=1024x1024&w=is&k=20&c=ogVKCS26t23fSvgCO77CC_6mhtxMDk2cmBOUQ9VamYo="
}
]