dynamic opengraph images

This commit is contained in:
2025-03-14 08:22:32 -04:00
parent 4d2febd262
commit e162d6a46c
35 changed files with 310 additions and 208 deletions
+3 -7
View File
@@ -7,11 +7,9 @@ import styles from "./Image.module.css";
const MAX_WIDTH = 865;
export type ImageProps = ComponentPropsWithoutRef<typeof NextImage> & {
inline?: boolean; // don't wrap everything in a `<div>` block
};
export type ImageProps = ComponentPropsWithoutRef<typeof NextImage>;
const Image = ({ src, height, width, quality, placeholder, inline, className, ...rest }: ImageProps) => {
const Image = ({ src, height, width, quality, placeholder, className, ...rest }: ImageProps) => {
const constrainWidth = (width?: number | `${number}`) => {
if (!width) return MAX_WIDTH;
@@ -27,9 +25,7 @@ const Image = ({ src, height, width, quality, placeholder, inline, className, ..
...rest,
};
const StyledImageWithProps = <NextImage className={clsx(styles.image, className)} {...imageProps} />;
return inline ? StyledImageWithProps : <div className={styles.block}>{StyledImageWithProps}</div>;
return <NextImage className={clsx(styles.image, className)} {...imageProps} />;
};
export default Image;