1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-12-05 14:18:58 -05:00

make sticky header optional via prop

This commit is contained in:
2022-02-16 10:30:18 -05:00
parent b6c018875f
commit 17104d765b
14 changed files with 116 additions and 120 deletions

View File

@@ -1,10 +1,9 @@
import { useEffect, useRef } from "react";
import classNames from "classnames/bind";
import classNames from "classnames";
import styles from "./Wallpaper.module.css";
const cx = classNames.bind(styles);
type WallpaperProps = JSX.IntrinsicElements["div"] & {
type WallpaperProps = JSX.IntrinsicElements["main"] & {
image: string;
tile?: boolean;
};
@@ -16,7 +15,7 @@ const Wallpaper = ({ image, tile, className, ...rest }: WallpaperProps) => {
bgRef.current.style.backgroundImage = `url(${image})`;
}, []); // eslint-disable-line react-hooks/exhaustive-deps
return <main ref={bgRef} className={cx(styles.wallpaper, { tile: !!tile }, className)} {...rest} />;
return <main ref={bgRef} className={classNames(styles.wallpaper, tile && styles.tile, className)} {...rest} />;
};
export default Wallpaper;