Skip to content

Commit cde8d9c

Browse files
authored
Merge pull request #2 from MorganDawe/master
little bit of cleaning up.
2 parents 8fa9090 + 911aadb commit cde8d9c

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

.env

100644100755
File mode changed.

README.md

100644100755
File mode changed.

src/App.css

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
.logo {
66
height: 10vmin;
77
pointer-events: none;
8-
margin: 1.5rem auto;
8+
max-height: 10vmin;
9+
margin: .5rem;
910
}
1011

1112
.App-header {
@@ -16,26 +17,34 @@
1617
justify-content: center;
1718
font-size: calc(10px + 2vmin);
1819
color: white;
20+
margin-bottom: .5rem;
1921
}
2022

2123
.App-link {
2224
color: #61dafb;
2325
}
2426

25-
.grid {
26-
width: 100%;
27-
display: inline-block;
28-
position: relative;
29-
max-width: 1165px;
30-
margin: 0 auto;
31-
}
32-
3327
.grid-sizer,
3428
.grid-item {
3529
width: 25%;
3630
}
3731

32+
.grid {
33+
margin: 0 auto;
34+
max-width: 1165px;
35+
}
36+
3837
.grid-item img {
3938
width: 100%;
4039
max-width: 100%;
4140
}
41+
42+
.grid-item-inner {
43+
margin: .5rem;
44+
background-color: #282c34;
45+
color: white;
46+
}
47+
48+
.grid-item-data {
49+
padding: .5rem;
50+
}

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class App extends Component {
2929
<img src={dgi_logo} className="logo" alt="logo" />
3030
</header>
3131

32-
<Gallery islandora_data={this.state.data}/>
32+
<Gallery elements={this.state.data}/>
3333
</div>
3434
);
3535
}

src/components/Masonry/masonry.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ const masonryOptions = {
1111
class Gallery extends React.Component {
1212

1313
render() {
14-
const islandoraNodes = this.props.islandora_data.map(function(obj_data){
15-
return (
16-
<div key={obj_data.uuid} className="grid-item">
17-
<div className="grid-item-inner">
18-
<a href={obj_data.path} title={obj_data.name} target="_blank" rel="noopener noreferrer">
19-
<img src={obj_data.img_src} alt={obj_data.name}/>
20-
<h2>{obj_data.name}</h2>
21-
</a>
22-
</div>
23-
</div>
24-
);
25-
});
14+
const childElements = this.props.elements.map(function(element){
15+
return (
16+
<div key={element.uuid} className="grid-item">
17+
<div className={'grid-item-inner'}>
18+
<div className={'grid-item-data'}>
19+
<a href={element.path} target={"_blank"} rel="noopener noreferrer">
20+
<img src={element.img_src} alt={element.name} title={element.name} />
21+
</a>
22+
<h2>{element.name}</h2>
23+
</div>
24+
</div>
25+
</div>
26+
);
27+
});
2628

2729
return (
2830
<Masonry
@@ -33,7 +35,7 @@ class Gallery extends React.Component {
3335
updateOnEachImageLoad={false} // default false and works only if disableImagesLoaded is false
3436
>
3537
<div className="grid-sizer"></div>
36-
{islandoraNodes}
38+
{childElements}
3739
</Masonry>
3840
);
3941
}

0 commit comments

Comments
 (0)