Skip to content

Commit 5d2e992

Browse files
author
Jonas Gossens
committed
💄 Improve Image and ImageContainer
1 parent c6df81c commit 5d2e992

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

examples/react-chayns-gallery/Example.jsx

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ export default class GalleryExample extends Component {
6565
styleLandscape={{ borderRadius: '10px' }}
6666
stylePortrait={{ border: '3px solid black' }}
6767
/>
68+
<Image
69+
image={images[0]}
70+
/>
6871
<h3>ImageContainer-Component</h3>
6972
<ImageContainer
7073
tools={[

src/react-chayns-gallery/component/Image.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export default class Image extends PureComponent {
5252
}
5353

5454
componentDidMount() {
55-
this.getElementDimensions();
5655
this.init();
5756
}
5857

@@ -72,6 +71,8 @@ export default class Image extends PureComponent {
7271
};
7372

7473
init = async () => { // set url and metadata
74+
this.getElementDimensions();
75+
7576
const { image, styleLandscape, stylePortrait } = this.props;
7677

7778
if (typeof image === 'string') { // url

src/react-chayns-gallery/component/Image.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.cc__image {
22
position: relative;
3-
height: auto;
3+
height: 100%;
44
display: flex;
55
flex: 1;
66
-ms-flex: 1;

src/react-chayns-gallery/component/ImageContainer.scss

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
left: 0;
1111
bottom: 0;
1212
right: 0;
13+
display: flex;
14+
justify-content: center;
15+
align-items: center;
1316
}
1417

1518
&__tools {

0 commit comments

Comments
 (0)