generated from taylorbryant/gatsby-starter-tailwind
-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring photogallerymodal to look more like recentmediacard
- Loading branch information
1 parent
da18a37
commit 0562319
Showing
5 changed files
with
99 additions
and
33 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,9 @@ | ||
# Auth0.com | ||
AUTH0_CLIENT_SECRET=PkfojbazYk5Pmr-duoF6GjYQvNP2pvMvMlMYe2Hwx0b2FpQT8iM83MvQK711_Grf | ||
AUTH0_MGMT_CLIENT_SECRET=pic00B-lXVlzoMWQTHNpXIMdTVF6D-UgiKzLWiWcWmNH77ZKS2gn6WMSu8nQMVnb | ||
|
||
# Google cloud storage | ||
[email protected] | ||
GC_BUCKET_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCd7Ntal+ECKAo+\nVNIV2RqpfN777Y8Po2SqoSjBYvcYag+unGOrAZVaFRWjPgJc/0Kuzdn1TZwwXxD+\nQ0gtnHaAqnswWftmKCy4b1TbJ0aEepmz6yt82OCY9Ct8+bwKAJhI74ilGLi6HG83\na+8jdgGJhIdeOMWJ2vpNaDXibMYQp6S9Pf60SdbshbpLcspz4Ww5kvNkfNE4PcEi\nUV/dce0S6EkbpR9NBGfUlciYogUjpJOpVLSbtYA1utrZJXq+g/5tznTTRifFTwcO\njmGWNZGe4A+ZxGUSoA+TG+bC1+8oVrJUXFsxznFx86LMpcOitzDD17hmhbiWrch2\n4+XXvKU/AgMBAAECggEALx7lomXP1udgixGe77LsQCcIl43d0lIz7q+QbAdd5/R5\ngmWaXYNm7058Os19QgdN+79jKczC7jHnbZ5gsm9Ncn2rrRUkLGqPUWayoINb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TtKH8xFODlacEZ4qPcuQp2lZxMMFYy+0JylGWJ4pCQLCls+nIdkZd3z76\nXdsBQ+P7VnbUk/PbbBpBZQ0=\n-----END PRIVATE KEY-----\n" | ||
|
||
NEXT_PUBLIC_DEVTOOLS_ENABLED=true |
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,82 @@ | ||
import { useState } from 'react' | ||
import Image from 'next/image' | ||
import clx from 'classnames' | ||
import Card from '../ui/Card/Card' | ||
import TagList from '../media/TagList' | ||
import { MobileLoader } from '../../js/sirv/util' | ||
import { MediaWithTags } from '../../js/types' | ||
import { getUploadDateSummary } from '../../js/utils' | ||
import { PostHeader } from '../home/Post' | ||
|
||
const MOBILE_IMAGE_MAX_WIDITH = 600 | ||
|
||
interface GalleryImageCardProps { | ||
header?: JSX.Element | ||
mediaWithTags: MediaWithTags | ||
onImageClick?: (event: React.MouseEvent<HTMLImageElement>, mediaWithTags: MediaWithTags) => void | ||
} | ||
|
||
/** | ||
* Image card for the gallery page | ||
*/ | ||
export const GalleryImageCard = ({ | ||
mediaWithTags, | ||
onImageClick | ||
}: GalleryImageCardProps): JSX.Element => { | ||
const [loaded, setLoaded] = useState(false) | ||
const { mediaUrl, width, height, username } = mediaWithTags | ||
const imageRatio = width / height | ||
return ( | ||
<Card | ||
header={<PostHeader username={username} />} | ||
image={ | ||
<div className='relative block w-full h-full'> | ||
<Image | ||
src={MobileLoader({ | ||
src: mediaUrl, | ||
width: MOBILE_IMAGE_MAX_WIDITH | ||
})} | ||
width={MOBILE_IMAGE_MAX_WIDITH} | ||
height={MOBILE_IMAGE_MAX_WIDITH / imageRatio} | ||
sizes='100vw' | ||
objectFit='cover' | ||
onLoad={() => setLoaded(true)} | ||
onClick={(event) => { | ||
if (onImageClick != null) { | ||
console.log('onImageClick') | ||
event.stopPropagation() | ||
event.preventDefault() | ||
onImageClick(event, mediaWithTags) | ||
} | ||
}} | ||
/> | ||
<div | ||
className={clx( | ||
'absolute top-0 left-0 w-full h-full', | ||
loaded | ||
? 'bg-transparent' | ||
: 'bg-gray-50 bg-opacity-60 border animate-pulse' | ||
)} | ||
> | ||
{loaded} | ||
</div> | ||
</div> | ||
} | ||
body={ | ||
<> | ||
<section className='flex flex-col gap-y-4 justify-between px-2'> | ||
<TagList | ||
mediaWithTags={mediaWithTags} | ||
showActions={false} | ||
isAuthorized={false} | ||
isAuthenticated={false} | ||
/> | ||
<span className='uppercase text-xs text-base-200'> | ||
{getUploadDateSummary(mediaWithTags.uploadTime)} | ||
</span> | ||
</section> | ||
</> | ||
} | ||
/> | ||
) | ||
} |
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
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
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