Skip to content
This repository was archived by the owner on Aug 8, 2019. It is now read-only.

Commit 78f90ae

Browse files
committed
Merge with club information
1 parent eb81850 commit 78f90ae

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

client/src/components/gallery.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import React from "react";
33
import { jsx } from "@emotion/core";
44
import "react-image-gallery/styles/css/image-gallery.css";
55
import ImageGallery from "react-image-gallery";
6-
import { useClubs } from "../selectors/selectors";
76

8-
function Gallery({ id }) {
9-
const clubs = useClubs();
7+
function Gallery({ club }) {
108
const [images, setImages] = React.useState([]);
119

1210
function getImagesReady(originalArray) {
@@ -16,10 +14,11 @@ function Gallery({ id }) {
1614
};
1715
});
1816
}
17+
console.log(club);
1918

2019
React.useEffect(() => {
21-
setImages(getImagesReady(clubs[0].image));
22-
}, []);
20+
setImages(getImagesReady(club ? club.image : []));
21+
}, [club]);
2322

2423
return (
2524
<div
@@ -28,7 +27,7 @@ function Gallery({ id }) {
2827
objectFit: "cover",
2928
maxHeight: "45vw",
3029
"@media screen and (min-width: 530px)": {
31-
maxHeight: "300px"
30+
height: "300px"
3231
}
3332
}
3433
}}

client/src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import CreateSportField from "./views/create-sport-field";
1616
import OwnerSportField from "./views/owner-sport-field";
1717
import Clubs from "./views/clubs";
1818
import Favorites from "./views/favorites";
19-
import Clubs from "./views/clubs";
2019
import Navbar from "./components/navbar";
2120
import { register } from "./service-worker";
2221

client/src/views/clubs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import { jsx } from "@emotion/core";
44
import { Title, Text, Card } from "../components/ui";
55
import { clubData } from "../services/club";
66
import SportfieldInfo from "../components/sportfield-info";
7+
import Gallery from "../components/gallery";
78

89
function Clubs({ id }) {
9-
const [club, setClub] = React.useState({ sport_fields: [] });
10+
const [club, setClub] = React.useState({ sport_fields: [], image: [] });
1011

1112
React.useEffect(() => {
1213
clubData(id).then(data => {
@@ -20,6 +21,7 @@ function Clubs({ id }) {
2021

2122
return (
2223
<div>
24+
<Gallery club={club} />
2325
<div
2426
css={{
2527
display: "flex",

0 commit comments

Comments
 (0)