This repository was archived by the owner on Aug 8, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,10 +3,8 @@ import React from "react";
33import { jsx } from "@emotion/core" ;
44import "react-image-gallery/styles/css/image-gallery.css" ;
55import 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 } }
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import CreateSportField from "./views/create-sport-field";
1616import OwnerSportField from "./views/owner-sport-field" ;
1717import Clubs from "./views/clubs" ;
1818import Favorites from "./views/favorites" ;
19- import Clubs from "./views/clubs" ;
2019import Navbar from "./components/navbar" ;
2120import { register } from "./service-worker" ;
2221
Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ import { jsx } from "@emotion/core";
44import { Title , Text , Card } from "../components/ui" ;
55import { clubData } from "../services/club" ;
66import SportfieldInfo from "../components/sportfield-info" ;
7+ import Gallery from "../components/gallery" ;
78
89function 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" ,
You can’t perform that action at this time.
0 commit comments