diff --git a/site/components/common/Footer/Footer.tsx b/site/components/common/Footer/Footer.tsx index 18e9b4027..b2447f0cd 100644 --- a/site/components/common/Footer/Footer.tsx +++ b/site/components/common/Footer/Footer.tsx @@ -1,6 +1,7 @@ import { FC } from 'react' import cn from 'clsx' import Link from 'next/link' +import dynamic from 'next/dynamic' import { useRouter } from 'next/router' import type { Page } from '@commerce/types/page' import getSlug from '@lib/get-slug' @@ -9,6 +10,13 @@ import { Logo, Container } from '@components/ui' import { I18nWidget } from '@components/common' import s from './Footer.module.css' +const ThemeSwitcher = dynamic(() => import('@components/ui/ThemeSwitcher'), { + ssr: false, + loading: () => ( +
+ ), +}) + interface Props { className?: string children?: any @@ -40,7 +48,7 @@ const Footer: FC = ({ className, pages }) => {
-
+
{[...links, ...sitePages].map((page) => ( @@ -53,8 +61,10 @@ const Footer: FC = ({ className, pages }) => { ))}
-
-
+
+
+ + = ({ className, pages }) => { > -
diff --git a/site/components/icons/System.tsx b/site/components/icons/System.tsx new file mode 100644 index 000000000..bb7367c7a --- /dev/null +++ b/site/components/icons/System.tsx @@ -0,0 +1,19 @@ +const System = ({ ...props }) => ( + + + +) + +export default System diff --git a/site/components/icons/index.ts b/site/components/icons/index.ts index 12e0cc202..72a65494c 100644 --- a/site/components/icons/index.ts +++ b/site/components/icons/index.ts @@ -11,6 +11,7 @@ export { default as Cross } from './Cross' export { default as Minus } from './Minus' export { default as Check } from './Check' export { default as Github } from './Github' +export { default as System } from './System' export { default as Vercel } from './Vercel' export { default as MapPin } from './MapPin' export { default as ArrowLeft } from './ArrowLeft' diff --git a/site/components/ui/ThemeSwitcher/ThemeIcon.tsx b/site/components/ui/ThemeSwitcher/ThemeIcon.tsx new file mode 100644 index 000000000..ae998602c --- /dev/null +++ b/site/components/ui/ThemeSwitcher/ThemeIcon.tsx @@ -0,0 +1,22 @@ +import { Moon, Sun, System } from '@components/icons' + +interface ThemeIconProps { + theme: string + width: number + height: number +} + +const ThemeIcon = ({ theme, ...props }: ThemeIconProps) => { + switch (theme) { + case 'light': + return + + case 'dark': + return + + default: + return + } +} + +export default ThemeIcon diff --git a/site/components/ui/ThemeSwitcher/ThemeSwitcher.tsx b/site/components/ui/ThemeSwitcher/ThemeSwitcher.tsx new file mode 100644 index 000000000..55671afc9 --- /dev/null +++ b/site/components/ui/ThemeSwitcher/ThemeSwitcher.tsx @@ -0,0 +1,77 @@ +import { useState } from 'react' +import { useTheme } from 'next-themes' +import { ChevronUp, Cross } from '@components/icons' + +import cn from 'clsx' +import ClickOutside from '@lib/click-outside' +import ThemeIcon from './ThemeIcon' + +const ThemeSwitcher = () => { + const [display, setDisplay] = useState(false) + const { theme, themes, setTheme } = useTheme() + + return ( + setDisplay(false)}> + + + ) +} + +export default ThemeSwitcher diff --git a/site/components/ui/ThemeSwitcher/index.ts b/site/components/ui/ThemeSwitcher/index.ts new file mode 100644 index 000000000..2b4931135 --- /dev/null +++ b/site/components/ui/ThemeSwitcher/index.ts @@ -0,0 +1 @@ +export { default } from './ThemeSwitcher'