theme-switcher.tsx — ui Source File
Architecture documentation for theme-switcher.tsx, a tsx file in the ui codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 75013c00_bd3d_e479_0a0e_fbe3db8f3726["theme-switcher.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 75013c00_bd3d_e479_0a0e_fbe3db8f3726 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"] 75013c00_bd3d_e479_0a0e_fbe3db8f3726 --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb 8c6845ea_e0db_55db_4a65_df2f64d9e581["use-config"] 75013c00_bd3d_e479_0a0e_fbe3db8f3726 --> 8c6845ea_e0db_55db_4a65_df2f64d9e581 style 75013c00_bd3d_e479_0a0e_fbe3db8f3726 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import { useSelectedLayoutSegment } from "next/navigation"
import { useConfig } from "@/hooks/use-config"
export function ThemeSwitcher() {
const [config] = useConfig()
const segment = useSelectedLayoutSegment()
React.useEffect(() => {
document.body.classList.forEach((className) => {
if (className.match(/^theme.*/)) {
document.body.classList.remove(className)
}
})
const theme = segment === "themes" ? config.theme : null
if (theme) {
return document.body.classList.add(`theme-${theme}`)
}
}, [segment, config])
return null
}
Domain
Subdomains
Functions
Dependencies
- navigation
- react
- use-config
Source
Frequently Asked Questions
What does theme-switcher.tsx do?
theme-switcher.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, UIPrimitives subdomain.
What functions are defined in theme-switcher.tsx?
theme-switcher.tsx defines 1 function(s): ThemeSwitcher.
What does theme-switcher.tsx depend on?
theme-switcher.tsx imports 3 module(s): navigation, react, use-config.
Where is theme-switcher.tsx in the architecture?
theme-switcher.tsx is located at deprecated/www/components/theme-switcher.tsx (domain: ComponentRegistry, subdomain: UIPrimitives, directory: deprecated/www/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free