1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-16 20:45:31 -04:00

<IFrame /> component

This commit is contained in:
2022-01-18 13:54:12 -05:00
parent eb172b83b0
commit caac9b905a
15 changed files with 141 additions and 78 deletions

View File

@@ -0,0 +1,15 @@
.figure {
margin: 1em auto;
text-align: center;
}
.caption {
font-size: 0.9em;
line-height: 1.5;
color: var(--medium);
}
/* some figcaptions contain paragraphs, some don't, so reset all of them */
.caption p {
margin: 0;
}

View File

@@ -3,6 +3,8 @@ import innerText from "react-innertext";
import type { ReactNode } from "react";
import type { ImageProps as NextImageProps } from "next/image";
import styles from "./Figure.module.css";
type Props = Omit<NextImageProps, "alt"> & {
children: ReactNode; // caption (can be in markdown, yay!!!)
alt?: string; // becomes optional -- pulled from plaintext-ified caption if missing
@@ -10,9 +12,9 @@ type Props = Omit<NextImageProps, "alt"> & {
const Figure = ({ children, alt, ...imageProps }: Props) => {
return (
<figure>
<figure className={styles.figure}>
<Image alt={alt || innerText(children)} {...imageProps} />
<figcaption>{children}</figcaption>
<figcaption className={styles.caption}>{children}</figcaption>
</figure>
);
};