forked from once-ui-system/magic-portfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
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
81b6b0a
commit 5ba8997
Showing
5 changed files
with
151 additions
and
29 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
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,33 @@ | ||
"use client"; | ||
|
||
import Masonry from 'react-masonry-css'; | ||
import { SmartImage } from "@/once-ui/components"; | ||
import { gallery } from "@/app/resources"; | ||
import styles from "@/app/gallery/Gallery.module.scss"; | ||
|
||
export default function MasonryGrid() { | ||
const breakpointColumnsObj = { | ||
default: 4, | ||
1440: 3, | ||
1024: 2, | ||
560: 1 | ||
}; | ||
|
||
return ( | ||
<Masonry | ||
breakpointCols={breakpointColumnsObj} | ||
className={styles.masonryGrid} | ||
columnClassName={styles.masonryGridColumn}> | ||
{gallery.images.map((image, index) => ( | ||
<SmartImage | ||
key={index} | ||
radius="m" | ||
aspectRatio={image.orientation === "horizontal" ? "16 / 9" : "9 / 16"} | ||
src={image.src} | ||
alt={image.alt} | ||
className={styles.gridItem} | ||
/> | ||
))} | ||
</Masonry> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,33 +1,66 @@ | ||
"use client"; | ||
import { Flex } from "@/once-ui/components"; | ||
import MasonryGrid from "./components/MasonryGrid"; | ||
import { baseURL, gallery, person } from "../resources"; | ||
|
||
import Masonry from 'react-masonry-css'; | ||
import { SmartImage } from "@/once-ui/components"; | ||
import { gallery } from "@/app/resources"; | ||
import styles from "@/app/gallery/Gallery.module.scss"; | ||
export function generateMetadata() { | ||
const title = gallery.title; | ||
const description = gallery.description; | ||
const ogImage = `https://${baseURL}/og?title=${encodeURIComponent(title)}`; | ||
|
||
export default function Gallery() { | ||
const breakpointColumnsObj = { | ||
default: 4, | ||
1440: 3, | ||
1024: 2, | ||
560: 1 | ||
}; | ||
return { | ||
title, | ||
description, | ||
openGraph: { | ||
title, | ||
description, | ||
type: 'website', | ||
url: `https://${baseURL}/gallery`, | ||
images: [ | ||
{ | ||
url: ogImage, | ||
alt: title, | ||
}, | ||
], | ||
}, | ||
twitter: { | ||
card: 'summary_large_image', | ||
title, | ||
description, | ||
images: [ogImage], | ||
}, | ||
}; | ||
} | ||
|
||
export default function Gallery() { | ||
return ( | ||
<Masonry | ||
breakpointCols={breakpointColumnsObj} | ||
className={styles.masonryGrid} | ||
columnClassName={styles.masonryGridColumn}> | ||
{gallery.images.map((image, index) => ( | ||
<SmartImage | ||
key={index} | ||
radius="m" | ||
aspectRatio={image.orientation === "horizontal" ? "16 / 9" : "9 / 16"} | ||
src={image.src} | ||
alt={image.alt} | ||
className={styles.gridItem} | ||
/> | ||
))} | ||
</Masonry> | ||
<Flex fillWidth> | ||
<script | ||
type="application/ld+json" | ||
suppressHydrationWarning | ||
dangerouslySetInnerHTML={{ | ||
__html: JSON.stringify({ | ||
'@context': 'https://schema.org', | ||
'@type': 'ImageGallery', | ||
name: gallery.title, | ||
description: gallery.description, | ||
url: `https://${baseURL}/gallery`, | ||
image: gallery.images.map((image) => ({ | ||
'@type': 'ImageObject', | ||
url: `${baseURL}${image.src}`, | ||
description: image.alt, | ||
})), | ||
author: { | ||
'@type': 'Person', | ||
name: person.name, | ||
image: { | ||
'@type': 'ImageObject', | ||
url: `${baseURL}/images/avatar.png`, | ||
}, | ||
}, | ||
}), | ||
}} | ||
/> | ||
<MasonryGrid/> | ||
</Flex> | ||
); | ||
} |
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