import React, { useRef, useState } from 'react'
import ButtonWrapper from '../Buttons/ButtonWrapper'
import Button from '../Buttons/Button'
import PhotoPreviewModal from '../Modal/PhotoPreviewModal'
import ImportPhotoButton from '../Buttons/ImportPhotoButton'
import styles from './PhotoItemCard.module.scss'
import useGlobalConfig from '../Contexts/useGlobalConfig'
const PhotoItemCard = ({ layout, item }) => {
const { getDownloadedItemId } = useGlobalConfig()
const [isActivationModelOpen, setOpenActivationModal] = useState(false)
const cardRef = useRef(null)
const isPhotoImported = !!getDownloadedItemId(item.humane_id)
const imageUrl = item.cover_image_urls.w600 || item.cover_image_urls.w400 || item.cover_image_urls.w100
const previewImageUrl = item.cover_image_urls.w1200 || item.cover_image_urls.w1000 || item.cover_image_urls.w600
const backgroundImageInlineStyle = {
backgroundImage: `url('${imageUrl}')`
}
const cardStyle = {}
if (layout === 'masonry') {
cardStyle.width = `${item.calculatedMasonryWidth}%`
backgroundImageInlineStyle.paddingBottom = `${item.aspectRatioHeight}%`
}
return (
{isPhotoImported ? Imported : null}
{
if (e.target === cardRef.current) {
setOpenActivationModal(true)
}
}}
>
{item.title}
{isActivationModelOpen
? (
{
setOpenActivationModal(false)
}}
/>
)
: null}
)
}
export default PhotoItemCard
@import ../bower_components/tether/src/css/mixins/pie-clearfix
@import ../bower_components/tether/src/css/mixins/inline-block
@import ../bower_components/tether/src/css/helpers/tether
@import ../bower_components/tether/src/css/helpers/tether-theme-arrows
@import ./shepherd-theme-arrows-fix
$themePrefix: "shepherd"
$themeName: "default"
$arrowSize: 16px
$arrowPointerEvents: none
$backgroundColor: #f6f6f6
$color: #444
$useDropShadow: false
$headerBackgroundColor: #e6e6e6
$zIndex: 9999
$maxWidth: 24em
+tether($themePrefix: $themePrefix)
+tether-theme-arrows($themePrefix: $themePrefix, $themeName: $themeName, $arrowSize: $arrowSize, $arrowPointerEvents: $arrowPointerEvents, $backgroundColor: $backgroundColor, $color: $color, $useDropShadow: $useDropShadow)
// Shepherd specific styles
.#{ $themePrefix }-element.#{ $themePrefix }-theme-#{ $themeName }
z-index: $zIndex
max-width: $maxWidth
font-size: 1em
// Make the arrow 5color the same as the header color when the arrow is on the top
&.#{ $themePrefix }-element-attached-top.#{ $themePrefix }-element-attached-center, &.#{ $themePrefix }-element-attached-top.#{ $themePrefix }-element-attached-right.#{ $themePrefix }-target-attached-bottom, &.#{ $themePrefix }-element-attached-top.#{ $themePrefix }-element-attached-left.#{ $themePrefix }-target-attached-bottom
&.#{ $themePrefix }-has-title .#{ $themePrefix }-content:before
border-bottom-color: $headerBackgroundColor
&.#{ $themePrefix }-has-title .#{ $themePrefix }-content header
background: $headerBackgroundColor
padding: 1em
a.shepherd-cancel-link
padding: 0
margin-bottom: 0
&.#{ $themePrefix }-has-cancel-link .#{ $themePrefix }-content header h3
float: left
.#{ $themePrefix }-content
box-shadow: 0 0 0 1px rgba(0, 0, 0, .17)
padding: 0
*
font-size: inherit
header
+pie-clearfix
border-radius: 5px 5px 0 0
h3
margin: 0
line-height: 1
font-weight: normal
a.shepherd-cancel-link
float: right
text-decoration: none
font-size: 1.25em
line-height: .8em
font-weight: normal
color: rgba(0, 0, 0, .5)
opacity: 0.25
position: relative
top: .1em
padding: .8em
margin-bottom: -.8em
&:hover
opacity: 1
.#{ $themePrefix }-text
padding: 1em
p
margin: 0 0 .5em 0
line-height: 1.3em
&:last-child
margin-bottom: 0
footer
padding: 0 1em 1em
.#{ $themePrefix }-buttons
text-align: right
list-style: none
padding: 0
margin: 0
li
display: inline
padding: 0
margin: 0
.shepherd-button
+inline-block
border-radius: 3px
cursor: pointer
border: 0
margin: 0 .5em 0 0
font-family: inherit
text-transform: uppercase
letter-spacing: .1em
font-size: .8em
line-height: 1em
padding: .75em 2em
background: #3288e6
color: #fff
&.shepherd-button-secondary
background: #eee
color: #888
&:last-child .shepherd-button
margin-right: 0
.#{ $themePrefix }-start-tour-button.#{ $themePrefix }-theme-#{ $themeName }
+inline-block
border-radius: 3px
cursor: pointer
border: 0
margin: 0 .5em 0 0
font-family: inherit
text-transform: uppercase
letter-spacing: .1em
font-size: .8em
line-height: 1em
padding: .75em 2em
background: #3288e6
color: #fff