Skip to content

Commit

Permalink
feat: update dark/light toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
TechInnovatorAI committed Sep 2, 2024
1 parent 252f859 commit 86793a1
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 10 deletions.
4 changes: 0 additions & 4 deletions examples/guider/kitchen-sink/theme.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ const siteTemplate = site('docs', {
dropdown: [
link('Documentation', '/docs/guides', { icon: 'fa6-solid:house' }),
],
// navigation: [
// link('Email Support', '/docs/guides', { icon: 'fa6-solid:house' }),
// link('Polymarket', 'https://polymarket.com/'),
// ],
});

export default defineTheme([
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"typescript": "^5.4.5",
"vite": "^5.4.2",
"vitest": "^1.6.0"
},
"dependencies": {
"lucide-react": "^0.437.0"
}
}
17 changes: 11 additions & 6 deletions packages/guider/src/client/partials/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ import { HeaderDropdown } from './dropdown';
import { SidebarMobileNav } from './sidebar-mobile-nav';
import { TopMobileNav } from './top-mobile-nav';
import { HeaderSearch } from './search';
import { Sun } from 'lucide-react';
import { Moon } from 'lucide-react';


export function HeaderInternal() {
const ctx = useContext(GuiderLayoutContext);
const [isDark, setIsDark] = useState(false);
const { site, settings } = useGuider(ctx?.meta);

console.log(settings.colors.background);

const [isScrolledFromTop, setIsScrolledFromTop] = useState(false);

useEffect(() => {
Expand Down Expand Up @@ -43,7 +49,7 @@ export function HeaderInternal() {
)}
>
<div className="gd-fixed neato-guider-overlay gd-transition-opacity gd-duration-150 gd-opacity-0 gd-inset-0 gd-bg-gradient-to-b gd-from-black/80 gd-to-transparent gd-z-[60] gd-pointer-events-none" />
<div className="gd-flex gd-justify-between gd-mb-6">
<div className="gd-flex gd-justify-between gd-mb-6 gd-items-center">
<div className="gd-flex gd-items-center">
<GuiderLogo />
{site.dropdown.length > 0 ? (
Expand All @@ -63,11 +69,10 @@ export function HeaderInternal() {
/>
) : null}
</div>
{/* <div className="gd-flex gd-items-center">
<span className="gd-inline-flex gd-items-center gd-justify-center gd-p-2 gd-bg-indigo-500 gd-rounded-md gd-shadow-lg">
<svg className="gd-h-6 gd-w-6 gd-text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"></svg>
</span>
</div> */}
{isDark ?
<Moon onClick={() => setIsDark(false)} /> :
<Sun onClick={() => setIsDark(true)} />
}
<div className="gd-flex md:gd-hidden gd-items-center">
{site.navigation.length > 0 || site.github ? (
<TopMobileNav
Expand Down
2 changes: 2 additions & 0 deletions packages/guider/src/theme/components/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const baseLayoutConfig: PopulatedLayoutSettings = {
textLighter: '#9AB3BD',
textHighlight: '#FFFFFF',
background: '#050F13',
backgroundLight: '#f5f9fa',
backgroundDark: '#050F13',
backgroundLighter: '#07171C',
backgroundLightest: '#081E24',
backgroundDarker: '#040C0F',
Expand Down
2 changes: 2 additions & 0 deletions packages/guider/src/theme/components/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export type PopulatedLayoutSettings = {
primaryLighter: string;
primaryDarker: string;
background: string;
backgroundLight: string;
backgroundDark: string;
backgroundLighter: string;
backgroundLightest: string;
text: string;
Expand Down
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 86793a1

Please sign in to comment.