-
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
Showing
38 changed files
with
961 additions
and
541 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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
"use client"; | ||
import PropTypes from "prop-types"; | ||
import { | ||
Image, | ||
|
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
Empty file.
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,53 @@ | ||
import { FC } from "react"; | ||
import classNames from "classnames"; | ||
import Link, { LinkProps } from "next/link"; | ||
import { type ImageShape } from "@rubin-epo/epo-react-lib/Image"; | ||
import ResponsiveImage from "@rubin-epo/epo-react-lib/ResponsiveImage"; | ||
import Figure from "@rubin-epo/epo-react-lib/Figure"; | ||
import styles from "./styles.module.css"; | ||
|
||
interface AsideImageProps { | ||
link?: LinkProps; | ||
image: ImageShape; | ||
caption?: string; | ||
className?: string; | ||
} | ||
|
||
const AsideImage: FC<AsideImageProps> = ({ | ||
link, | ||
image, | ||
caption, | ||
className, | ||
}) => { | ||
return ( | ||
<Figure | ||
className={classNames(styles.figure, className)} | ||
caption={ | ||
caption && | ||
(link ? ( | ||
<Link | ||
prefetch={false} | ||
{...link} | ||
className={styles.captionLink} | ||
dangerouslySetInnerHTML={{ __html: caption }} | ||
/> | ||
) : ( | ||
<div | ||
className={styles.caption} | ||
dangerouslySetInnerHTML={{ __html: caption }} | ||
/> | ||
)) | ||
} | ||
> | ||
<ResponsiveImage | ||
className={styles.image} | ||
image={image} | ||
aspectRatio="8:5" | ||
/> | ||
</Figure> | ||
); | ||
}; | ||
|
||
AsideImage.displayName = "Molecule.Aside.Image"; | ||
|
||
export default AsideImage; |
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,42 @@ | ||
.figure { | ||
--figure-padding: 0; | ||
|
||
position: relative; | ||
|
||
&:has(a:focus-visible), | ||
&:has(a:hover) { | ||
& .image { | ||
filter: invert(25%) sepia(80%) saturate(102%) hue-rotate(130deg) | ||
brightness(100%) contrast(100%); | ||
opacity: 0.7; | ||
} | ||
} | ||
} | ||
|
||
.image { | ||
background-color: var(--color-background-tile-light); | ||
opacity: 1; | ||
transition: filter 0.2s ease 0s, opacity 0.2s ease 0s; | ||
} | ||
|
||
.caption { | ||
display: block; | ||
margin-block-start: var(--size-spacing-2xs); | ||
} | ||
|
||
.captionLink { | ||
composes: caption; | ||
|
||
color: var(--color-background-accent-aside); | ||
text-decoration: none; | ||
|
||
&:focus-visible { | ||
outline: none; | ||
} | ||
|
||
&::after { | ||
content: ""; | ||
position: absolute; | ||
inset: 0; | ||
} | ||
} |
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,25 @@ | ||
import { FC, PropsWithChildren } from "react"; | ||
import classNames from "classnames"; | ||
import styles from "./styles.module.css"; | ||
|
||
interface AsideSectionProps { | ||
title?: string; | ||
className?: string; | ||
} | ||
|
||
const AsideSection: FC<PropsWithChildren<AsideSectionProps>> = ({ | ||
title, | ||
children, | ||
className, | ||
}) => { | ||
return ( | ||
<section className={classNames(styles.section, className)}> | ||
{title && <h3 className={styles.title}>{title}</h3>} | ||
{children} | ||
</section> | ||
); | ||
}; | ||
|
||
AsideSection.displayName = "Page.Aside.Section"; | ||
|
||
export default AsideSection; |
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,14 @@ | ||
import PropTypes from "prop-types"; | ||
import * as Styled from "./styles"; | ||
|
||
const Aside = ({ children }) => { | ||
return <Styled.Aside>{children}</Styled.Aside>; | ||
}; | ||
|
||
Aside.displayName = "Page.Aside"; | ||
|
||
Aside.propTypes = { | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default Aside; |
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,48 @@ | ||
import AsideImage from "@/components/molecules/Aside/Image"; | ||
import { cantoToImageShape } from "@/lib/api/canto"; | ||
import { assetTitle } from "@/lib/api/canto/metadata"; | ||
import { getGalleryForAsset } from "@/lib/api/galleries/asset"; | ||
import { addLocaleUriSegment } from "@/lib/i18n"; | ||
import { getLocale } from "@/lib/i18n/server"; | ||
import { type ImageShape } from "@rubin-epo/epo-react-lib/Image"; | ||
import { FC, Suspense } from "react"; | ||
|
||
interface GalleryAssetProps { | ||
asset: any; | ||
} | ||
|
||
interface GalleryAssetContentProps { | ||
id: string; | ||
image: ImageShape; | ||
caption?: string; | ||
} | ||
|
||
const GalleryAssetContent: FC<GalleryAssetContentProps> = async ({ | ||
id, | ||
image, | ||
caption, | ||
}) => { | ||
const uri = await getGalleryForAsset(id); | ||
const link = uri | ||
? { href: addLocaleUriSegment(getLocale(), `${uri}/${id}`) } | ||
: undefined; | ||
|
||
return <AsideImage {...{ image, caption }} link={link} />; | ||
}; | ||
|
||
const GalleryAsset: FC<GalleryAssetProps> = ({ asset }) => { | ||
const image = cantoToImageShape(asset, 240); | ||
const caption = assetTitle(asset.metadata); | ||
|
||
if (!image) return null; | ||
|
||
return ( | ||
<Suspense fallback={<AsideImage {...{ image, caption }} />}> | ||
<GalleryAssetContent id={asset.id} {...{ image, caption }} /> | ||
</Suspense> | ||
); | ||
}; | ||
|
||
GalleryAsset.displayName = "Organism.MediaAside.GalleryAsset"; | ||
|
||
export default GalleryAsset; |
Oops, something went wrong.