-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c97811
commit 2b43227
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { css } from '@emotion/react'; | ||
|
||
// TODO: replace with import of image, rather than grabbing one off the web | ||
const noImagePlaceholder = | ||
'https://socialistmodernism.com/wp-content/uploads/2017/07/placeholder-image.png'; | ||
|
||
const CreateImageBlock = (image) => { | ||
return ( | ||
<a href={image} target="_blank" rel="noreferrer"> | ||
<img | ||
src={image} | ||
alt="placeholder-text" | ||
css={css` | ||
width: 285px; | ||
height: 207px; | ||
background: linear-gradient(0deg, #f3f4f4, #f3f4f4), | ||
linear-gradient( | ||
293.05deg, | ||
#70d3af -73.46%, | ||
#007e8a -24.52%, | ||
#052a3a 69.75% | ||
); | ||
border: 1px solid rgba(0, 0, 0, 0.1); | ||
box-sizing: border-box; | ||
box-shadow: inset 0px 0px 0px 4px #ffffff; | ||
border-radius: 4px; | ||
padding: 3px; | ||
margin-right: 16px; | ||
margin-bottom: 6px; | ||
object-fit: cover; | ||
`} | ||
/> | ||
</a> | ||
); | ||
}; | ||
|
||
/** | ||
* @param {Object} props | ||
* @param {String[]} props.images - Array of images urls. | ||
* @param {String} props.className | ||
*/ | ||
const ImageGallery = ({ images, className }) => { | ||
return ( | ||
<div | ||
className={className} | ||
css={css` | ||
display: flex; | ||
white-space: nowrap; | ||
overflow-x: auto; | ||
margin-bottom: 32px; | ||
`} | ||
> | ||
{images && images.length > 0 | ||
? images.map((image) => { | ||
return CreateImageBlock(image); | ||
}) | ||
: CreateImageBlock(noImagePlaceholder)} | ||
</div> | ||
); | ||
}; | ||
|
||
ImageGallery.propTypes = { | ||
images: PropTypes.arrayOf(PropTypes.string), | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default ImageGallery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ImageGallery'; |