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

fix unnoticeable background color bug in dark mode

This commit is contained in:
2022-02-05 14:50:29 -05:00
parent ca7d21b3d2
commit 42a7ff1bdc
26 changed files with 118 additions and 81 deletions

View File

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