Skip to content

Commit

Permalink
👍 feat(theme): enable system theme for dark and light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nyomansunima committed Jan 5, 2025
1 parent 57fdce7 commit 83f0f6d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
25 changes: 16 additions & 9 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Metadata } from 'next'
import { config, sharedMetadata } from '@shared/libs'
import { fonts } from '@shared/libs'
import '@shared/styles/globals.css'
import { PosthogProvider } from '@shared/providers'
import { PosthogProvider, ThemeProvider } from '@shared/providers'
import { CenteredLayout, Footer, Header, Toaster } from '@shared/components'

export const metadata: Metadata = {
Expand Down Expand Up @@ -53,14 +53,21 @@ export default function RootLayout({
>
<PosthogProvider>
<body suppressHydrationWarning>
<CenteredLayout>
<Header />
<main className="min-h-screen pt-20 pb-36 tablet:pt-0 tablet:pb-56">
{children}
</main>
<Footer />
</CenteredLayout>
<Toaster />
<ThemeProvider
attribute={'class'}
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<CenteredLayout>
<Header />
<main className="min-h-screen pt-20 pb-36 tablet:pt-0 tablet:pb-56">
{children}
</main>
<Footer />
</CenteredLayout>
<Toaster />
</ThemeProvider>
</body>
</PosthogProvider>
</html>
Expand Down
2 changes: 1 addition & 1 deletion src/features/home/project-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function ProjectItem({ project }: ProjectItemProps): React.ReactElement {
const { href, label, title } = project

return (
<li className="flex items-center group text-blue-600 transition-all duration-300 hover:-translate-y-1">
<li className="flex items-center group text-blue-600 dark:text-blue-400 transition-all duration-300 hover:-translate-y-1">
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/common/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function ArticleContent({
children,
}: ArticleContentProps): React.ReactElement {
return (
<article className="prose prose-sm tablet:prose-base tablet:prose-p:text-base prose-headings:!leading-tight prose-h1:text-xl prose-h2:text-lg prose-h3:text-base tablet:prose-li:text-base max-w-none prose-headings:font-medium prose-strong:font-medium prose-neutral prose-code:font-mono prose-img:overflow-hidden prose-img:border prose-img:border-border prose-img:bg-ambient prose-img:rounded-xl prose-pre:bg-surface prose-pre:text-foreground prose-pre:border prose-pre:border-border prose-pre:font-medium overflow-hidden prose-p:text-foreground prose-li:text-foreground prose-a:!text-blue-600 dark:prose-a:!text-blue-400 prose-p:leading-7">
<article className="prose prose-sm tablet:prose-base tablet:prose-p:text-base prose-headings:!leading-tight prose-h1:text-xl prose-h2:text-lg prose-h3:text-base tablet:prose-li:text-base max-w-none prose-headings:font-medium prose-strong:font-medium prose-neutral prose-code:font-mono prose-img:overflow-hidden prose-img:border prose-img:border-border prose-img:bg-ambient prose-img:rounded-xl prose-pre:bg-surface prose-pre:text-foreground prose-pre:border prose-pre:border-border prose-pre:font-medium overflow-hidden prose-p:text-foreground prose-li:text-foreground prose-a:!text-blue-600 dark:prose-a:!text-blue-400 prose-p:leading-7 prose-a:!no-underline">
{children}
</article>
)
Expand Down

0 comments on commit 83f0f6d

Please sign in to comment.