Skip to content

Commit 5c31ba6

Browse files
author
SHoltkamp
committed
Change code style
1 parent 90355ab commit 5c31ba6

File tree

4 files changed

+50
-36
lines changed

4 files changed

+50
-36
lines changed

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

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,32 @@ export default class Gallery extends React.Component {
3333
return (
3434
<div className="chayns-gallery" >
3535
<div className="gallery-grid">
36-
<ImageContainer
37-
className="gallery_item"
38-
url={urls[0]}
39-
onClick={this.openFirstImage}
40-
/>
41-
{count > 1 ?
42-
<ImageContainer
43-
className="gallery_item"
44-
url={urls[1]}
45-
onClick={this.openSecondImage}
46-
/> : ''}
47-
{count > 2 ?
48-
<ImageContainer
49-
className="gallery_item"
50-
url={urls[2]}
51-
onClick={this.openThirdImage}
52-
>
53-
{count > 3 ?
54-
<MoreImages
55-
count={count - 3}
56-
onlyIcon={onlyIcon}
57-
/> : ''
58-
}
59-
</ImageContainer> : ''}
36+
<ImageContainer
37+
className="gallery_item"
38+
url={urls[0]}
39+
onClick={this.openFirstImage}
40+
/>
41+
{(count > 1) && (
42+
<ImageContainer
43+
className="gallery_item"
44+
url={urls[1]}
45+
onClick={this.openSecondImage}
46+
/>
47+
)}
48+
{(count > 2) && (
49+
<ImageContainer
50+
className="gallery_item"
51+
url={urls[2]}
52+
onClick={this.openThirdImage}
53+
>
54+
{(count > 3) && (
55+
<MoreImages
56+
count={count - 3}
57+
onlyIcon={onlyIcon}
58+
/>
59+
)}
60+
</ImageContainer>
61+
)}
6062
</div>
6163
</div>
6264
);

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
/* eslint-disable jsx-a11y/click-events-have-key-events */
12
import React from 'react';
23
import PropTypes from 'prop-types';
34

45

5-
const ImageContainer = ({ className, url, onClick, children }) => {
6+
const ImageContainer = ({
7+
className,
8+
url,
9+
onClick,
10+
children,
11+
}) => {
612
return(
713
<div className={className}>
814
<div
9-
className='gallery_item_inner'
15+
className="gallery_item_inner"
1016
style={{ backgroundImage: `url(${url})` }}
1117
onClick={onClick}
12-
>{children}</div>
18+
>
19+
{children}
20+
</div>
1321
</div>
1422
);
1523
};
@@ -23,6 +31,6 @@ ImageContainer.propTypes = {
2331

2432
ImageContainer.defaultProps = {
2533
children: undefined
26-
}
34+
};
2735

2836
export default ImageContainer;

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ const MoreImages = ({ count, onlyIcon }) => {
99
<div className="more-images__container">
1010
<div className="more-image__text__wrapper">
1111
<i className="more-image__icon fa fa-plus"/>
12-
{onlyIcon ? '' :
13-
<div className="more-image__text">{text}</div>
14-
}
12+
{(!onlyIcon) && (
13+
<div className="more-image__text">
14+
{text}
15+
</div>
16+
)}
1517
</div>
1618
</div>
1719
</div>
@@ -23,6 +25,8 @@ MoreImages.propTypes = {
2325
onlyIcon: PropTypes.bool
2426
};
2527

26-
28+
MoreImages.defaultProps = {
29+
onlyIcon: false
30+
};
2731

2832
export default MoreImages;

src/react-chayns-gallery/index.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
flex-flow: column;
1313
position: absolute;
1414
flex-wrap: wrap;
15-
top: 0px;
16-
right: 0px;
17-
bottom: 0px;
18-
left: 0px;
15+
top: 0;
16+
right: 0;
17+
bottom: 0;
18+
left: 0;
1919
.gallery_item {
2020
height: 50%;
2121
.gallery_item_inner {

0 commit comments

Comments
 (0)