mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-21 07:21:17 -04:00
all components should accept additional classnames
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Image from "../Image/Image";
|
||||
import innerText from "react-innertext";
|
||||
import classNames from "classnames";
|
||||
import type { ReactNode } from "react";
|
||||
import type { ImageProps as NextImageProps } from "next/image";
|
||||
|
||||
@@ -8,11 +9,12 @@ 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
|
||||
className?: string;
|
||||
};
|
||||
|
||||
const Figure = ({ children, alt, ...imageProps }: Props) => {
|
||||
const Figure = ({ children, alt, className, ...imageProps }: Props) => {
|
||||
return (
|
||||
<figure className={styles.figure}>
|
||||
<figure className={classNames(styles.figure, className)}>
|
||||
<Image alt={alt || innerText(children)} {...imageProps} />
|
||||
<figcaption className={styles.caption}>{children}</figcaption>
|
||||
</figure>
|
||||
|
Reference in New Issue
Block a user