mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-03 17:26:37 -04:00
dynamic opengraph images
This commit is contained in:
@ -24,7 +24,6 @@ const Header = ({ className, ...rest }: HeaderProps) => {
|
||||
height={70}
|
||||
quality={60}
|
||||
placeholder="empty"
|
||||
inline
|
||||
priority
|
||||
/>
|
||||
<span className={styles.name}>{config.authorName}</span>
|
||||
|
@ -3,12 +3,3 @@
|
||||
max-width: 100%;
|
||||
border-radius: var(--radii-corner);
|
||||
}
|
||||
|
||||
.block {
|
||||
display: block;
|
||||
line-height: 0;
|
||||
|
||||
/* default to centering all images */
|
||||
margin: 1em auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user