From e3321edf9b33de6545dfc382f2f791c7eedea34d Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Mon, 7 Mar 2022 16:54:33 -0800 Subject: [PATCH] Some header fixes --- client/components/header/controls.tsx | 44 ++++++++++++++++++++++ client/components/header/header.module.css | 21 ++++++++++- client/components/header/index.tsx | 22 +++++------ 3 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 client/components/header/controls.tsx diff --git a/client/components/header/controls.tsx b/client/components/header/controls.tsx new file mode 100644 index 00000000..c268b99a --- /dev/null +++ b/client/components/header/controls.tsx @@ -0,0 +1,44 @@ +import React, { useMemo } from 'react' +import Router, { useRouter } from 'next/router' +import MoonIcon from '@geist-ui/icons/moon' +import SunIcon from '@geist-ui/icons/sun' +import UserIcon from '@geist-ui/icons/user' +import GitHubIcon from '@geist-ui/icons/github' +import { Select, Spacer, useTheme } from '@geist-ui/core' +import { ThemeProps } from '../../pages/_app' +// import { useAllThemes, useTheme } from '@geist-ui/core' +import styles from './header.module.css' + +const Controls = ({ changeTheme, theme }: ThemeProps) => { + const switchThemes = (type: string | string[]) => { + changeTheme() + if (typeof window === 'undefined' || !window.localStorage) return + window.localStorage.setItem('drift-theme', Array.isArray(type) ? type[0] : type) + } + + + return ( +
+ +
+ ) +} + +export default React.memo(Controls); diff --git a/client/components/header/header.module.css b/client/components/header/header.module.css index 0a6cd1e8..7b1d1e25 100644 --- a/client/components/header/header.module.css +++ b/client/components/header/header.module.css @@ -11,7 +11,7 @@ display: none; } -@media only screen and (max-width: 600px) { +@media only screen and (max-width: 650px) { .tabs { display: none; } @@ -31,3 +31,22 @@ height: 40px; padding: 0; } + +.wrapper { + display: flex; + align-items: center; + width: min-content; +} + +.selectContent { + width: auto; + height: 18px; + display: flex; + justify-content: space-between; + align-items: center; +} + +.selectContent :global(svg) { + margin-right: 10px; + margin-left: 2px; +} diff --git a/client/components/header/index.tsx b/client/components/header/index.tsx index c901a14c..55fb6a3e 100644 --- a/client/components/header/index.tsx +++ b/client/components/header/index.tsx @@ -5,9 +5,11 @@ import { useEffect, useMemo, useState } from "react"; import styles from './header.module.css'; import { useRouter } from "next/router"; import useSignedIn from "../../lib/hooks/use-signed-in"; +import Mobile from "./controls"; +import Controls from "./controls"; -const Header = ({ changeTheme }: DriftProps) => { +const Header = ({ changeTheme, theme }: DriftProps) => { const router = useRouter(); const [selectedTab, setSelectedTab] = useState(); const [expanded, setExpanded] = useState(false) @@ -43,12 +45,12 @@ const Header = ({ changeTheme }: DriftProps) => { icon: , condition: isSignedIn }, - { - name: "Settings", - href: "/", - icon: , - condition: isSignedIn - }, + // { + // name: "Settings", + // href: "/settings", + // icon: , + // condition: isSignedIn + // }, { name: "Sign out", action: () => { @@ -107,7 +109,6 @@ const Header = ({ changeTheme }: DriftProps) => { } }}> {pages.map((tab, index) => { - console.log(tab, tab.condition) if (tab.condition) return {
- {isMobile ? ( + {isMobile && ( - ) : ( - // - <> )}