Skip to content

Commit

Permalink
Implement Dark Mode Support
Browse files Browse the repository at this point in the history
close vercel-labs#17

Co-Authored-By: ruru <[email protected]>
  • Loading branch information
ruru-m07 and ruru-m07 committed Apr 11, 2024
1 parent 3965598 commit 95582a8
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion components/chat-history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function ChatHistory({ userId }: ChatHistoryProps) {
href="/"
className={cn(
buttonVariants({ variant: 'outline' }),
'h-10 w-full justify-start bg-zinc-50 px-4 shadow-none transition-colors hover:bg-zinc-200/40'
'h-10 w-full justify-start bg-secondary px-4 shadow-none transition-colors hover:bg-zinc-200/40'
)}
>
<IconPlus className="-translate-x-2 stroke-2" />
Expand Down
6 changes: 3 additions & 3 deletions components/chat-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function ChatPanel({
]

return (
<div className="fixed inset-x-0 bg-white/90 bottom-0 w-full duration-300 ease-in-out peer-[[data-state=open]]:group-[]:lg:pl-[250px] peer-[[data-state=open]]:group-[]:xl:pl-[300px] dark:from-10%">
<div className="fixed inset-x-0 bottom-0 w-full duration-300 ease-in-out peer-[[data-state=open]]:group-[]:lg:pl-[250px] peer-[[data-state=open]]:group-[]:xl:pl-[300px] dark:from-10%">
<ButtonScrollToBottom
isAtBottom={isAtBottom}
scrollToBottom={scrollToBottom}
Expand All @@ -63,7 +63,7 @@ export function ChatPanel({
<div
key={example.heading}
className={cn(
'cursor-pointer bg-zinc-50 text-zinc-950 rounded-2xl p-4 sm:p-6 hover:bg-zinc-100 transition-colors',
'cursor-pointer bg-secondary rounded-2xl p-4 sm:p-6 transition-colors',
index > 1 && 'hidden md:block'
)}
onClick={async () => {
Expand Down Expand Up @@ -104,7 +104,7 @@ export function ChatPanel({
}}
>
<div className="font-medium">{example.heading}</div>
<div className="text-sm text-zinc-800">
<div className="text-sm text-muted-foreground">
{example.subheading}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions components/empty-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { ExternalLink } from '@/components/external-link'
export function EmptyScreen() {
return (
<div className="mx-auto max-w-2xl px-4">
<div className="flex flex-col gap-2 rounded-2xl bg-zinc-50 sm:p-8 p-4 text-sm sm:text-base">
<div className="flex flex-col gap-2 rounded-2xl bg-secondary sm:p-8 p-4 text-sm sm:text-base">
<h1 className="text-2xl sm:text-3xl tracking-tight font-semibold max-w-fit inline-block">
Next.js Gemini Chatbot
</h1>
<p className="leading-normal text-zinc-900">
<p className="leading-normal text-muted-foreground">
This is an open source AI chatbot app template built with{' '}
<ExternalLink href="https://nextjs.org">Next.js</ExternalLink>, the{' '}
<ExternalLink href="https://sdk.vercel.ai">
Expand All @@ -19,7 +19,7 @@ export function EmptyScreen() {
</ExternalLink>
.
</p>
<p className="leading-normal text-zinc-900">
<p className="leading-normal text-muted-foreground">
It uses{' '}
<ExternalLink href="https://vercel.com/blog/ai-sdk-3-generative-ui">
React Server Components
Expand Down
6 changes: 3 additions & 3 deletions components/prompt-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function PromptForm({
}
}}
/>
<div className="relative flex max-h-60 w-full grow flex-col overflow-hidden bg-zinc-100 px-12 sm:rounded-full sm:px-12">
<div className="relative flex max-h-60 w-full grow flex-col overflow-hidden bg-secondary px-12 sm:rounded-full sm:px-12">
{/* <Tooltip>
<TooltipTrigger asChild> */}
<Button
Expand All @@ -140,7 +140,7 @@ export function PromptForm({
tabIndex={0}
onKeyDown={onKeyDown}
placeholder="Send a message."
className="min-h-[60px] w-full bg-transparent placeholder:text-zinc-900 resize-none px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"
className="min-h-[60px] w-full bg-transparent placeholder:text-muted-foreground resize-none px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"
autoFocus
spellCheck={false}
autoComplete="off"
Expand All @@ -157,7 +157,7 @@ export function PromptForm({
type="submit"
size="icon"
disabled={input === ''}
className="bg-transparent shadow-none text-zinc-950 rounded-full hover:bg-zinc-200"
className="bg-transparent shadow-none text-secondary-foreground rounded-full hover:bg-secondary-foreground/25"
>
<IconArrowElbow />
<span className="sr-only">Send message</span>
Expand Down
14 changes: 11 additions & 3 deletions components/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ import * as React from 'react'
import { ThemeProviderProps } from 'next-themes/dist/types'
import { SidebarProvider } from '@/lib/hooks/use-sidebar'
import { TooltipProvider } from '@/components/ui/tooltip'
import { ThemeProvider } from '@/components/theme-provider'

export function Providers({ children, ...props }: ThemeProviderProps) {
return (
<SidebarProvider>
<TooltipProvider>{children}</TooltipProvider>
</SidebarProvider>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<SidebarProvider>
<TooltipProvider>{children}</TooltipProvider>
</SidebarProvider>
</ThemeProvider>
)
}
2 changes: 1 addition & 1 deletion components/sidebar-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function SidebarList({ userId }: SidebarListProps) {
)}
</div>
<div className="flex items-center justify-between p-4">
{/* <ThemeToggle /> */}
<ThemeToggle />
<ClearHistory clearChats={clearChats} isEnabled={chats?.length > 0} />
</div>
</div>
Expand Down
9 changes: 9 additions & 0 deletions components/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use client"

import * as React from "react"
import { ThemeProvider as NextThemesProvider } from "next-themes"
import { type ThemeProviderProps } from "next-themes/dist/types"

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
}

0 comments on commit 95582a8

Please sign in to comment.