Skip to content

Commit b3f04a6

Browse files
committed
add ExpandImage component
1 parent 1e13238 commit b3f04a6

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

website/src/components/ExpandImage.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
3+
const ExpandImage = ({ children }) => {
4+
5+
const StyledChildren = () =>
6+
React.Children.map(children, child => {
7+
return (
8+
<div className='image-container-175mw'>
9+
{child}
10+
</div>
11+
)
12+
}
13+
);
14+
15+
return <StyledChildren />;
16+
}
17+
18+
export default ExpandImage

website/src/css/custom.css

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,58 @@
1717
--ifm-footer-background-color: #0c2c40
1818
}
1919

20+
.image-container-175mw {
21+
position: relative;
22+
max-width: 175px;
23+
margin-left: auto;
24+
margin-right: auto;
25+
}
26+
27+
/* from https: //stackoverflow.com/questions/19104018/how-to-expand-an-image-in-html-by-clicking-on-it */
28+
.image-container-175mw::after {
29+
color: white;
30+
display: flex;
31+
justify-content: center;
32+
align-items: center;
33+
font-size: 30px;
34+
font-weight: 600;
35+
position: absolute;
36+
height: 100%;
37+
width: 100%;
38+
top: 0;
39+
text-align: center;
40+
text-shadow: 0 0 30px #000;
41+
transition: .5s ease;
42+
background-color: rgba(0, 0, 0, 0.4);
43+
content: "Hover to expand";
44+
}
45+
46+
.image-container-175mw:hover::after {
47+
opacity: 0;
48+
}
49+
50+
.image-container-175mw > svg {
51+
max-width: 175px;
52+
height: auto;
53+
margin-left: auto;
54+
margin-right: auto;
55+
display: block;
56+
opacity: 0.8;
57+
}
58+
59+
.image-container-175mw:hover > svg {
60+
color: #424242;
61+
-webkit-transition: all .3s ease-in;
62+
-moz-transition: all .3s ease-in;
63+
-ms-transition: all .3s ease-in;
64+
-o-transition: all .3s ease-in;
65+
transition: all .3s ease-in;
66+
opacity: 1;
67+
transform: scale(1.55);
68+
-ms-transform: scale(1.55); /* IE 9 */
69+
-webkit-transform: scale(1.55); /* Safari and Chrome */
70+
}
71+
2072
html footer {
2173
--ifm-footer-title-color: rgb(255, 255, 255);
2274
--ifm-footer-link-color: #dadde1;

0 commit comments

Comments
 (0)