This repository was archived by the owner on Feb 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 9 files changed +18
-14
lines changed
Expand file tree Collapse file tree 9 files changed +18
-14
lines changed Original file line number Diff line number Diff line change 11import React , { Component } from 'react'
2+ import { Link } from 'react-router-dom'
23import pictures from '../sampleData/pictures'
34import './Picture.css'
45
@@ -10,7 +11,7 @@ class Picture extends Component {
1011 < article >
1112 < h2 > Picture details</ h2 >
1213 < h3 > { pictures [ pictureIndex ] . name } </ h3 >
13- < p > It is only about a single picture.</ p >
14+ < p > It is only about a single picture. Go back to < Link to = "/pictures" > gallery </ Link > </ p >
1415 < div >
1516 < img src = { pictures [ pictureIndex ] . url } alt = "Nice one" />
1617 </ div >
Original file line number Diff line number Diff line change 1919 font-weight : 400 ;
2020}
2121
22- .Picture > img {
22+ .Picture > a {
23+ display : block;
24+ }
25+
26+ .Picture > a > img {
2327 display : block;
2428 width : 100% ;
2529 height : auto;
Original file line number Diff line number Diff line change @@ -7,11 +7,10 @@ const RenderPictures = (picturesList) => {
77 return picturesList . map ( ( picture , index ) => {
88 return (
99 < div className = "Picture" key = { `MyPicture_${ index } ` } >
10- < img src = { picture . url } alt = { picture . name } />
10+ < Link to = { `/picture/${ index } ` } >
11+ < img src = { picture . url } alt = { picture . name } />
12+ </ Link >
1113 < div className = "Picture-name" > { picture . name } </ div >
12- < div className = "Picture-details-link" >
13- < Link to = { `/picture/${ index } ` } > { picture . name } »</ Link >
14- </ div >
1514 </ div >
1615 )
1716 } )
Original file line number Diff line number Diff line change 11const pictures = [
22 {
3- name : "Landscape " ,
4- url : "/images/picture-00.png " ,
3+ name : "Architecture " ,
4+ url : "/images/architecture.jpg " ,
55 } ,
66 {
7- name : "Bird's Eye View " ,
8- url : "/images/picture-00.png " ,
7+ name : "Night Shot " ,
8+ url : "/images/night-shot.jpg " ,
99 } ,
1010 {
11- name : "Vehicle " ,
12- url : "/images/picture-00.png " ,
11+ name : "The Shard " ,
12+ url : "/images/shard-clouds.jpg " ,
1313 } ,
1414 {
15- name : "Clouds " ,
16- url : "/images/picture-00.png " ,
15+ name : "Tower Bridge " ,
16+ url : "/images/tower-bridge.jpg " ,
1717 }
1818]
1919
You can’t perform that action at this time.
0 commit comments