mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-12-05 13:38:57 -05:00
make sticky header optional via prop
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user