Write out images in per-album json.

This commit is contained in:
2020-02-09 12:34:53 -08:00
parent cced612139
commit df3d29ce7c
3 changed files with 41 additions and 28 deletions

View File

@@ -36,3 +36,7 @@
transform: rotate(360deg);
}
}
.figure {
width: 285px;
}

View File

@@ -1,5 +1,7 @@
import React from 'react';
import './App.css';
class Album extends React.Component {
constructor(props) {
super(props);
@@ -25,18 +27,16 @@ class Album extends React.Component {
} else if (album !== null) {
console.log(album);
return album.map((a) => {
let img = <img src="https://via.placeholder.com/256x128" className="mr-3" alt="unset"/>;
if (a.coverPhotoBaseUrl !== undefined) {
img = <img src={ a.coverPhotoBaseUrl + "=w256" } className="mr-3" alt={ a.title }/>;
}
let figure = <figure key={ a.id } className="figure">
{img}
<figcaption className="figure-caption">{ a.title || "No title" } - { a.mediaItemsCount || 0 } photos </figcaption>
</figure>;
return <a key={ a.id } href={ a.productUrl }>
{ figure }
// TODO(wathiede): use coverPhotoMediaItemId and fetch from a
// locally cached image.
return <figure key={ a.id } className="figure">
<img src={ a.baseUrl + "=w256-h256-c" } className="mr-3" alt={ a.filename }/>
<figcaption className="figure-caption">
<a key={ a.id } href={ a.productUrl }>
<p className="text-truncate">{ a.filename}</p>
</a>
</figcaption>
</figure>
});
} else {
return <h2>Loading...</h2>;