Skip to content

Commit

Permalink
Merge pull request #15 from Shubidumdu/dark-mode
Browse files Browse the repository at this point in the history
Dark mode
  • Loading branch information
Shubidumdu authored Aug 1, 2024
2 parents d36d15e + 134323d commit 70840b5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/app/components/Comment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const UTTERANCES_SCRIPT_OPTIONS = {
repo: 'Shubidumdu/shubidumdu.github.io',
'issue-term': 'pathname',
label: 'comment',
theme: 'github-light',
theme: window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark-blue'
: 'github-light',
crossorigin: 'anonymous',
} as const;

Expand Down
4 changes: 2 additions & 2 deletions src/app/components/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ const Post = ({ post, base }: PostProps) => {
if (!parsedMarkDown) return null;

return (
<div className="container m-auto max-w-4xl rounded max-sm:rounded-none p-4 font-mono bg-white shadow">
<div className="container m-auto max-w-4xl rounded max-sm:rounded-none p-4 font-mono bg-white dark:bg-gray-800 shadow">
<div className="flex justify-between">
<h3 className="text-gray-400 text-xs">{post.attributes.createdAt}</h3>
<div>
<BadgeList items={post.attributes.tags} />
</div>
</div>
<div
className="markdown-body font-mono pt-4"
className="markdown-body font-mono pt-4 dark:bg-gray-800"
dangerouslySetInnerHTML={{
__html: parsedMarkDown,
}}
Expand Down
15 changes: 11 additions & 4 deletions src/app/components/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const PostCard = ({
createdAt,
}: PostCardProps) => {
return (
<li className="bg-white rounded-md shadow hover:scale-105 transition-all">
<li className="bg-white dark:bg-gray-800 rounded-md shadow hover:scale-105 transition-all">
<Link className="h-full" href={`/posts/${id}`}>
<article className="flex flex-row h-full max-sm:flex-col">
<div
Expand All @@ -33,11 +33,18 @@ const PostCard = ({
/>
</div>
<div className="w-full p-4 pb-2 pt-2">
<h3 className="text-lg mb-1 font-bold text-gray-800">{title}</h3>
<p className="text-sm mb-2 font-normal text-gray-700">{desc}</p>
<h3 className="text-lg mb-1 font-bold text-gray-800 dark:text-gray-100">
{title}
</h3>
<p className="text-sm mb-2 font-normal text-gray-700 dark:text-gray-300">
{desc}
</p>
<div className="flex justify-between items-end">
{tags ? <BadgeList items={tags} /> : null}
<time className="text-xs text-gray-400" dateTime={createdAt}>
<time
className="text-xs text-gray-400 dark:text-gray-500"
dateTime={createdAt}
>
{createdAt}
</time>
</div>
Expand Down
10 changes: 7 additions & 3 deletions src/app/components/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ProjectCard = ({
createdAt,
}: ProjectCardProps) => {
return (
<li className="bg-white rounded-md shadow hover:scale-105 transition-all">
<li className="bg-white dark:bg-gray-800 rounded-md shadow hover:scale-105 transition-all">
<Link className="h-full" href={href}>
<article className="flex flex-row h-full max-sm:flex-col">
<div
Expand All @@ -37,8 +37,12 @@ const ProjectCard = ({
/>
</div>
<div className="w-full p-4 pb-2 pt-2">
<h3 className="text-lg mb-1 font-bold text-gray-800">{title}</h3>
<p className="text-sm mb-2 font-normal text-gray-700">{desc}</p>
<h3 className="text-lg mb-1 font-bold text-gray-800 dark:text-gray-100">
{title}
</h3>
<p className="text-sm mb-2 font-normal text-gray-700 dark:text-gray-300">
{desc}
</p>
<div className="flex justify-between items-end">
{tags ? <BadgeList items={tags} /> : null}
<time className="text-xs text-gray-400" dateTime={createdAt}>
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ const TopBar = () => {
const pathname = usePathname();

return (
<header className="bg-white font-mono w-full h-12 flex justify-between items-center drop-shadow-md z-50 fixed top-0 p-6">
<header className="bg-white dark:bg-gray-800 font-mono w-full h-12 flex justify-between items-center drop-shadow-md z-50 fixed top-0 p-6">
<Link href="/">
<h1 className="text-xl font-bold text-gray-600 hover:text-gray-800 transition-all">
<h1 className="text-xl font-bold text-gray-600 dark:text-gray-200 hover:text-gray-800 dark:hover:text-gray-400 transition-all">
Shubidumdu
</h1>
</Link>
<div className="flex gap-4">
{PATHS.map(({ path, label }, index) => (
<Link href={path} key={index}>
<h2
className={`text-l text-gray-600 hover:text-gray-800 hover:underline underline-offset-2 transition-all ${
className={`text-l text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-gray-500 hover:underline underline-offset-2 transition-all ${
pathname.includes(path) ? 'text-gray-800 font-bold' : ''
}`}
>
Expand Down
4 changes: 4 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}

.hljs {
color: #eef !important;
}
}

body {
Expand Down

0 comments on commit 70840b5

Please sign in to comment.