import React from "react"; import { Card, Row, Col } from "react-bootstrap"; import { Link } from "react-router-dom"; import ResponsiveImage from "./ResponsiveImage"; import { handleClickLink } from "./helper"; const MiniPhotos = (props) => { const { user, userID, linkHandling, ...rest } = props; const { linkRefs, linkState } = linkHandling; const [activeLink, setActiveLink] = linkState; const { photos: photosLinkRef } = linkRefs; const photos = user.photos; const NUMBER_OF_PHOTOS = 9; const photosLink = `/fakebook/${user.lastname}.${user.firstname}/Photos`; function handleClick() { handleClickLink( { currentTarget: photosLinkRef.current }, activeLink, setActiveLink ); } return ( Photos {photos.map((photo, index) => { return ( //we only render maximum 9 photos index < NUMBER_OF_PHOTOS && ( ) ); })} ); }; export default MiniPhotos;