diff --git a/app/routes/_layout.$postType.$/route.tsx b/app/routes/_layout.$postType.$/route.tsx index aa3ad91..4539c93 100644 --- a/app/routes/_layout.$postType.$/route.tsx +++ b/app/routes/_layout.$postType.$/route.tsx @@ -6,7 +6,8 @@ import type { import { json, redirect } from "@remix-run/cloudflare"; import { useLoaderData } from "@remix-run/react"; -import prism from "prismjs/themes/prism-okaidia.min.css"; +import dark from "prism-theme-github/themes/prism-theme-github-dark.css"; +import light from "prism-theme-github/themes/prism-theme-github-light.css"; import { z } from "zod"; import { Redirects } from "~/modules/redirects.server"; @@ -15,7 +16,10 @@ import { ArticleView } from "./article-view"; import { queryArticle, queryTutorial } from "./queries"; import { TutorialView } from "./tutorial-view"; -export const links: LinksFunction = () => [{ rel: "stylesheet", href: prism }]; +export const links: LinksFunction = () => [ + { rel: "stylesheet", href: light, media: "(prefers-color-scheme: light)" }, + { rel: "stylesheet", href: dark, media: "(prefers-color-scheme: dark)" }, +]; export async function loader({ request, params, context }: LoaderFunctionArgs) { let { postType, slug } = z diff --git a/app/routes/cms_.tutorials_.new/route.tsx b/app/routes/cms_.tutorials_.new/route.tsx index 72dfb33..2e0c2b0 100644 --- a/app/routes/cms_.tutorials_.new/route.tsx +++ b/app/routes/cms_.tutorials_.new/route.tsx @@ -1,9 +1,11 @@ import type { action as editorAction } from "../components.editor/route"; -import type { ActionFunctionArgs } from "@remix-run/cloudflare"; +import type { ActionFunctionArgs, LinksFunction } from "@remix-run/cloudflare"; import { redirect } from "@remix-run/cloudflare"; import { useFetcher } from "@remix-run/react"; import { parameterize } from "inflected"; +import dark from "prism-theme-github/themes/prism-theme-github-dark.css"; +import light from "prism-theme-github/themes/prism-theme-github-light.css"; import { useEffect, useMemo, useRef, useState } from "react"; import { Heading } from "react-aria-components"; import { useHydrated } from "remix-utils/use-hydrated"; @@ -23,6 +25,11 @@ import { Provider, useEditor } from "../components.editor/use-editor"; import { clearCache } from "./queries"; +export const links: LinksFunction = () => [ + { rel: "stylesheet", href: light, media: "(prefers-color-scheme: light)" }, + { rel: "stylesheet", href: dark, media: "(prefers-color-scheme: dark)" }, +]; + export const handle: SDX.Handle = { hydrate: true }; export async function action({ request, context }: ActionFunctionArgs) { diff --git a/bun.lockb b/bun.lockb index 1aa4603..bf76aa7 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 6aa921e..51f014e 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "isbot": "^4.4.0", "lucide-react": "^0.315.0", "nprogress": "^0.2.0", + "prism-theme-github": "^1.0.1", "prismjs": "^1.29.0", "react": "^18.2.0", "react-aria": "^3.31.1",