Skip to content

Commit 6aed03a

Browse files
committed
Dark mode support
1 parent fca1aa9 commit 6aed03a

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

web/src/app/layout.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export default function RootLayout({
5050
gtag('config', 'G-ZP11FFWXRN');`}
5151
</Script>
5252
</head>
53-
<body className={`${fontSerif.variable} ${fontSans.variable} font-sans`}>
53+
<body
54+
className={`${fontSerif.variable} ${fontSans.variable} font-sans bg-lightBg dark:bg-stone-900 dark:text-stone-200`}
55+
>
5456
{children}
5557
<AI />
5658
</body>

web/src/app/volumes/[id]/Summarize.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function Summarize(props: Props) {
5757
return (
5858
<section
5959
ref={summaryRef}
60-
className="border-t-2 border-b-2 pt-9 pb-5 my-9 border-neutral-300"
60+
className="border-t-2 border-b-2 pt-9 pb-5 my-9 border-neutral-300 dark:border-stone-700"
6161
>
6262
<h2 className="text-xl font-bold mb-4 text-center flex items-center">
6363
<span className="text-yellow-600 inline-block mr-2">
@@ -72,7 +72,7 @@ function Summarize(props: Props) {
7272
{result.highlight_ids.map((highlightId, index) => (
7373
<sup key={highlightId}>
7474
<Link
75-
className="underline text-neutral-500 inline-block ml-1"
75+
className="underline text-neutral-500 dark:text-stone-400 inline-block ml-1"
7676
href={`/highlights/${highlightId}`}
7777
>
7878
{index + 1}
@@ -89,7 +89,7 @@ function Summarize(props: Props) {
8989
return (
9090
<div className="text-center mb-10 lg:fixed lg:right-0 lg:bottom-0 lg:pb-2 lg:pr-2 lg:m-0">
9191
<button
92-
className="inline-flex bg-neutral-200 hover:bg-neutral-800 hover:text-white p-1 rounded-sm items-center text-xs"
92+
className="inline-flex bg-neutral-200 hover:bg-neutral-800 dark:bg-neutral-800 hover:text-white p-1 rounded-sm items-center text-xs"
9393
disabled={isFetching}
9494
onClick={() => setShowSummarize(true)}
9595
type="button"

web/src/components/AI.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export default function AI() {
260260
return (
261261
<QueryClientProvider client={queryClient}>
262262
<button
263-
className="fixed right-1 top-1 rounded-sm p-2 text-neutral-500 hover:text-black"
263+
className="fixed right-1 top-1 rounded-sm p-2 text-neutral-500 hover:text-black dark:hover:text-blue-600"
264264
onClick={showDialog}
265265
title="Open search"
266266
type="button"

web/src/components/Highlight.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const Highlight = (props: {
1313
<mark>{props.body}</mark>
1414
</blockquote>
1515
<Link
16-
className="text-sm text-slate-600 hover:underline"
16+
className="text-sm text-slate-600 dark:text-stone-400 hover:underline"
1717
href={`/highlights/${props.id}`}
1818
onClick={props.onLinkClick}
1919
prefetch={false}

web/src/components/VolumeHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const VolumeHeader = (props: { small?: boolean; volume: Volume }) => {
2424
{volume.title}
2525
</h1>
2626
{volume.subtitle && (
27-
<h2 className="text-center font-serif text-2xl font-normal italic antialiased">
27+
<h2 className="text-center font-serif text-2xl font-normal italic antialiased dark:text-stone-400">
2828
{volume.subtitle}
2929
</h2>
3030
)}

web/src/styles/globals.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
@tailwind components;
33
@tailwind utilities;
44

5-
body {
6-
background-color: #f6f6f1;
7-
}
8-
95
h1,
106
h2,
117
h3 {
@@ -59,6 +55,10 @@ mark,
5955
background-repeat: no-repeat;
6056
box-decoration-break: clone;
6157
color: theme("colors.black");
58+
59+
@media (prefers-color-scheme: dark) {
60+
--mark-color: rgba(255, 226, 130, 0.75);
61+
}
6262
}
6363

6464
.cover-link:is(:active, :focus) .cover-link__text {

web/tailwind.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ module.exports = {
66
aspectRatio: {
77
cover: "5 / 8",
88
},
9+
colors: {
10+
lightBg: "#f6f6f1",
11+
},
912
fontFamily: {
1013
// var's are set via @next/font
1114
sans: ["var(--font-ibm-plex)", "sans-serif"],

0 commit comments

Comments
 (0)