Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit 3edb17a

Browse files
committed
Add sample photos. Link to gallery from single page.
1 parent b568055 commit 3edb17a

File tree

9 files changed

+18
-14
lines changed

9 files changed

+18
-14
lines changed

public/images/architecture.jpg

119 KB
Loading

public/images/night-shot.jpg

144 KB
Loading

public/images/picture-00.png

-101 KB
Binary file not shown.

public/images/shard-clouds.jpg

159 KB
Loading

public/images/tower-bridge.jpg

251 KB
Loading

src/pages/Picture.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, {Component} from 'react'
2+
import {Link} from 'react-router-dom'
23
import pictures from '../sampleData/pictures'
34
import './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>

src/pages/Pictures.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
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;

src/pages/Pictures.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff 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} &raquo;</Link>
14-
</div>
1514
</div>
1615
)
1716
})

src/sampleData/pictures.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
const 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

0 commit comments

Comments
 (0)