1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-01 04:26:37 -04: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,9 +1,9 @@
import classNames from "classnames";
import type { BlockquoteHTMLAttributes } from "react";
import type { HTMLAttributes } from "react";
import styles from "./Blockquote.module.css";
type Props = BlockquoteHTMLAttributes<HTMLElement>;
type Props = HTMLAttributes<HTMLElement>;
const Blockquote = ({ className, ...rest }: Props) => (
<blockquote className={classNames(styles.blockquote, className)} {...rest} />

View File

@ -7,6 +7,7 @@
background-color: var(--code-background);
border: 1px solid var(--kinda-light);
border-radius: var(--rounded-edge-radius);
/* light-dark theme switch fading */
transition: background 0.25s ease, border 0.25s ease;
}
@ -32,6 +33,7 @@
border: 1px solid var(--kinda-light);
border-top-right-radius: var(--rounded-edge-radius);
border-end-start-radius: var(--rounded-edge-radius);
/* light-dark theme switch fading */
transition: background 0.25s ease, border 0.25s ease;
}

View File

@ -1,12 +1,10 @@
import classNames from "classnames";
import CopyButton from "../CopyButton/CopyButton";
import type { PropsWithChildren } from "react";
import type { HTMLAttributes } from "react";
import styles from "./CodeBlock.module.css";
type Props = PropsWithChildren<{
className?: string;
}>;
type Props = HTMLAttributes<HTMLElement>;
const CodeBlock = ({ children, className, ...rest }: Props) => {
if (className?.split(" ").includes("code-highlight")) {

View File

@ -3,20 +3,21 @@ import { useTheme } from "next-themes";
import classNames from "classnames";
import { Giscus } from "@giscus/react";
import { giscusConfig } from "../../lib/config";
import type { PropsWithChildren, HTMLAttributes } from "react";
import type { GiscusProps } from "@giscus/react";
import styles from "./Comments.module.css";
type Props = {
title: string;
className?: string;
};
type Props = HTMLAttributes<HTMLDivElement> &
PropsWithChildren<{
title: string;
}>;
const Comments = ({ title, className }: Props) => {
const Comments = ({ title, className, ...rest }: Props) => {
const { resolvedTheme } = useTheme();
return (
<div className={classNames(styles.wrapper, className)}>
<div className={classNames(styles.wrapper, className)} {...rest}>
<Giscus
{...(giscusConfig as GiscusProps)}
term={title}

View File

@ -7,6 +7,7 @@
color: var(--text);
background-color: var(--super-duper-light);
border-color: var(--light);
/* light-dark theme switch fading */
transition: background 0.25s ease;
}

View File

@ -1,6 +1,7 @@
.content {
font-size: 0.9em;
line-height: 1.7;
color: var(--text);
}
@media screen and (max-width: 768px) {

View File

@ -1,11 +1,9 @@
import classNames from "classnames";
import type { PropsWithChildren } from "react";
import type { HTMLAttributes } from "react";
import styles from "./Content.module.css";
type Props = PropsWithChildren<{
className?: string;
}>;
type Props = HTMLAttributes<HTMLDivElement>;
const Content = ({ className, ...rest }: Props) => <div className={classNames(styles.content, className)} {...rest} />;

View File

@ -2,7 +2,9 @@
width: 100%;
padding: 1.25em 1.5em;
border-top: 1px solid var(--kinda-light);
background-color: var(--background-outer);
color: var(--medium-dark);
/* light-dark theme switch fading */
transition: color 0.25s ease, background 0.25s ease, border 0.25s ease;
}

View File

@ -3,11 +3,14 @@ import Link from "next/link";
import classNames from "classnames";
import { HeartIcon, NextjsLogo } from "../Icons";
import * as config from "../../lib/config";
import type { HTMLAttributes } from "react";
import styles from "./Footer.module.css";
const Footer = () => (
<footer className={styles.footer}>
type Props = HTMLAttributes<HTMLDivElement>;
const Footer = ({ className, ...rest }: Props) => (
<footer className={classNames(styles.footer, className)} {...rest}>
<div className={styles.row}>
<div className={styles.license}>
Content{" "}

View File

@ -8,6 +8,7 @@
background-color: var(--background-header);
backdrop-filter: saturate(180%) blur(5px);
z-index: 1000;
/* light-dark theme switch fading */
transition: color 0.25s ease, background 0.25s ease, border 0.25s ease;
}

View File

@ -1,11 +1,15 @@
import { memo } from "react";
import classNames from "classnames";
import Selfie from "../Selfie/Selfie";
import Menu from "../Menu/Menu";
import type { HTMLAttributes } from "react";
import styles from "./Header.module.css";
const Header = () => (
<header className={styles.header}>
type Props = HTMLAttributes<HTMLDivElement>;
const Header = ({ className }: Props) => (
<header className={classNames(styles.header, className)}>
<nav className={styles.nav}>
<Selfie className={styles.selfie} />
<Menu className={styles.menu} />

View File

@ -1,9 +1,10 @@
import classNames from "classnames";
import { IframeHTMLAttributes } from "react";
import { HTMLAttributes } from "react";
import styles from "./IFrame.module.css";
type Props = IframeHTMLAttributes<HTMLElement> & {
type Props = HTMLAttributes<HTMLIFrameElement> & {
src: string;
height: number;
width?: number; // defaults to 100%
allowScripts?: boolean;

View File

@ -1,10 +1,12 @@
.main {
.flex {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.default {
width: 100%;
padding: 1.5em;
color: var(--text);
background-color: var(--background-inner);
/* light-dark theme switch fading */
transition: color 0.25s ease, background 0.25s ease, border 0.25s ease;
}
.container {
@ -13,6 +15,11 @@
display: block;
}
/* footer needs to fill the remaining vertical screen space. doing it here to keep flex stuff together. */
.footer {
flex: 1;
}
@media screen and (max-width: 768px) {
.main {
padding: 1.25em;

View File

@ -4,16 +4,16 @@ import classNames from "classnames";
import Header from "../Header/Header";
import Footer from "../Footer/Footer";
import { themeColors } from "../../lib/config";
import type { PropsWithChildren } from "react";
import type { PropsWithChildren, HTMLAttributes } from "react";
import styles from "./Layout.module.css";
type Props = PropsWithChildren<{
noContainer?: boolean; // pass true to disable default `<main>` container styles with padding, etc.
className?: string;
}>;
type Props = HTMLAttributes<HTMLDivElement> &
PropsWithChildren<{
noContainer?: boolean; // pass true to disable default `<main>` container styles with padding, etc.
}>;
const Layout = ({ noContainer, className, children }: Props) => {
const Layout = ({ noContainer, className, children, ...rest }: Props) => {
const { resolvedTheme } = useTheme();
return (
@ -24,17 +24,20 @@ const Layout = ({ noContainer, className, children }: Props) => {
</Head>
)}
<Header />
<div className={classNames(styles.flex, className)} {...rest}>
<Header />
{noContainer ? (
<main className={className}>{children}</main>
) : (
<main className={classNames(styles.main, className)}>
<div className={styles.container}>{children}</div>
</main>
)}
{/* passing `noContainer={true}` to Layout allows 100% control of the content area on a per-page basis */}
{noContainer ? (
<>{children}</>
) : (
<main className={styles.default}>
<div className={styles.container}>{children}</div>
</main>
)}
<Footer />
<Footer className={styles.footer} />
</div>
</>
);
};

View File

@ -1,5 +1,5 @@
.meta {
display: flex;
display: inline-flex;
flex-wrap: wrap;
font-size: 0.825em;
line-height: 2.3;

View File

@ -1,10 +1,11 @@
import Link from "next/link";
import classNames from "classnames";
import type { HTMLAttributes } from "react";
import type { NoteMetaType } from "../../types";
import styles from "./NoteTitle.module.css";
type Props = Pick<NoteMetaType, "slug" | "htmlTitle"> & { className?: string };
type Props = Pick<NoteMetaType, "slug" | "htmlTitle"> & HTMLAttributes<HTMLAnchorElement>;
const NoteTitle = ({ slug, htmlTitle, className, ...rest }: Props) => (
<h1 className={classNames(styles.title, className)}>

View File

@ -1,11 +1,11 @@
import classNames from "classnames";
import { OctocatOcticon } from "../Icons";
import type { HTMLAttributes } from "react";
import styles from "./OctocatLink.module.css";
type Props = {
type Props = HTMLAttributes<HTMLAnchorElement> & {
repo: string;
className?: string;
};
const OctocatLink = ({ repo, className, ...rest }: Props) => (

View File

@ -2,22 +2,20 @@ import { useRouter } from "next/router";
import Link from "next/link";
import classNames from "classnames";
import { baseUrl } from "../../lib/config";
import type { PropsWithChildren } from "react";
import type { HTMLAttributes } from "react";
import styles from "./PageTitle.module.css";
type Props = PropsWithChildren<{
className?: string;
}>;
type Props = HTMLAttributes<HTMLHeadingElement>;
const PageTitle = ({ className, ...rest }: Props) => {
const router = useRouter();
const canonical = `${baseUrl}${router.pathname}/`;
return (
<h1 className={classNames(styles.title, className)}>
<h1 className={classNames(styles.title, className)} {...rest}>
<Link href={canonical}>
<a className={styles.link} {...rest} />
<a className={styles.link} />
</Link>
</h1>
);

View File

@ -6,6 +6,7 @@
font-size: 0.85em;
color: var(--medium-dark);
border-color: var(--kinda-light);
/* light-dark theme switch fading */
transition: border 0.25s ease;
}

View File

@ -2,8 +2,8 @@ import Tweet from "react-tweet-embed";
type Props = {
id: string;
className?: string;
options?: object;
className?: string;
};
const TweetEmbed = ({ id, className, options }: Props) => (

View File

@ -1,9 +1,10 @@
import classNames from "classnames";
import ReactPlayer from "react-player/file";
import type { FilePlayerProps } from "react-player/file";
import styles from "./Video.module.css";
type Props = {
type Props = Partial<FilePlayerProps> & {
webm?: string;
mp4?: string;
thumbnail?: string;

View File

@ -1,8 +1,4 @@
.wallpaper {
display: flex;
justify-content: center;
align-items: center;
padding: 1.5em 0;
width: 100%;
min-height: 400px;
}

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;

View File

@ -1,9 +1,10 @@
import classNames from "classnames";
import ReactPlayer from "react-player/youtube";
import type { YouTubePlayerProps } from "react-player/youtube";
import styles from "./YouTubeEmbed.module.css";
type Props = {
type Props = Partial<YouTubePlayerProps> & {
id: string;
className?: string;
};