Skip to content

Commit 77ef623

Browse files
committed
25 - Showing a Play Button for each Image
1 parent 54c0f79 commit 77ef623

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

imgur-client/sass/image-preview.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
.image-preview {
22
display: inline-block;
3+
position: relative;
4+
5+
.glyphicon {
6+
position: absolute;
7+
top: 50%;
8+
left: 50%;
9+
transform: translate(-50%, -50%);
10+
font-size: 50px;
11+
opacity: .5;
12+
color: white;
13+
}
314

415
img {
516
height: 200px;

imgur-client/src/components/image-preview.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = React.createClass({
1313
onMouseLeave={this.handleMouseLeave}
1414
>
1515
{this.props.animated && this.state.hovering ? this.video() : this.image()}
16+
{this.props.animated && !this.state.hovering ? this.icon() : null }
1617
</div>
1718
},
1819
image: function() {
@@ -27,6 +28,9 @@ module.exports = React.createClass({
2728
</video>
2829
</div>
2930
},
31+
icon: function() {
32+
return <span className="glyphicon glyphicon-play"></span>
33+
},
3034
handleMouseEnter: function() {
3135
this.setState({hovering: true});
3236
},

0 commit comments

Comments
 (0)