Commit e02bba1b authored by tom's avatar tom Committed by isstuev

navigation in dark mode

parent 30c12294
<svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.632a2.632 2.632 0 1 1 5.263 0 2.632 2.632 0 0 1-5.263 0Zm7.368 0a2.632 2.632 0 1 1 5.263 0 2.632 2.632 0 0 1-5.263 0Zm10-2.632a2.632 2.632 0 1 0 0 5.263 2.632 2.632 0 0 0 0-5.263ZM0 10a2.632 2.632 0 1 1 5.263 0A2.632 2.632 0 0 1 0 10Zm7.368 0a2.632 2.632 0 1 1 5.263 0 2.632 2.632 0 0 1-5.263 0Zm10-2.632a2.632 2.632 0 1 0 0 5.264 2.632 2.632 0 0 0 0-5.264Zm-2.631 10a2.632 2.632 0 1 1 5.263 0 2.632 2.632 0 0 1-5.263 0ZM2.632 14.737a2.632 2.632 0 1 0 0 5.263 2.632 2.632 0 0 0 0-5.263Zm7.368 0A2.632 2.632 0 1 0 10 20a2.632 2.632 0 0 0 0-5.263Z" fill="#718096"/></svg> <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.632a2.632 2.632 0 1 1 5.263 0 2.632 2.632 0 0 1-5.263 0Zm7.368 0a2.632 2.632 0 1 1 5.263 0 2.632 2.632 0 0 1-5.263 0Zm10-2.632a2.632 2.632 0 1 0 0 5.263 2.632 2.632 0 0 0 0-5.263ZM0 10a2.632 2.632 0 1 1 5.263 0A2.632 2.632 0 0 1 0 10Zm7.368 0a2.632 2.632 0 1 1 5.263 0 2.632 2.632 0 0 1-5.263 0Zm10-2.632a2.632 2.632 0 1 0 0 5.264 2.632 2.632 0 0 0 0-5.264Zm-2.631 10a2.632 2.632 0 1 1 5.263 0 2.632 2.632 0 0 1-5.263 0ZM2.632 14.737a2.632 2.632 0 1 0 0 5.263 2.632 2.632 0 0 0 0-5.263Zm7.368 0A2.632 2.632 0 1 0 10 20a2.632 2.632 0 0 0 0-5.263Z" fill="currentColor"/></svg>
\ No newline at end of file \ No newline at end of file
import type { StyleFunctionProps } from '@chakra-ui/theme-tools';
import { mode } from '@chakra-ui/theme-tools';
const global = (props: StyleFunctionProps) => ({
body: {
bg: mode('white', 'black')(props),
},
})
export default global;
...@@ -5,6 +5,7 @@ import borders from './foundations/borders'; ...@@ -5,6 +5,7 @@ import borders from './foundations/borders';
import colors from './foundations/colors'; import colors from './foundations/colors';
import components from './components/index'; import components from './components/index';
import config from './config'; import config from './config';
import global from './global';
const overrides = { const overrides = {
...typography, ...typography,
...@@ -12,6 +13,9 @@ const overrides = { ...@@ -12,6 +13,9 @@ const overrides = {
colors, colors,
components, components,
config, config,
styles: {
global,
},
} }
export default extendTheme(overrides); export default extendTheme(overrides);
...@@ -2,6 +2,7 @@ import React from 'react'; ...@@ -2,6 +2,7 @@ import React from 'react';
import { Link, Icon, Text, HStack } from '@chakra-ui/react'; import { Link, Icon, Text, HStack } from '@chakra-ui/react';
import NextLink from 'next/link'; import NextLink from 'next/link';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import useColors from './useColors';
interface Props { interface Props {
pathname: string; pathname: string;
...@@ -13,6 +14,8 @@ const AccountNavLink = ({ text, pathname, icon }: Props) => { ...@@ -13,6 +14,8 @@ const AccountNavLink = ({ text, pathname, icon }: Props) => {
const router = useRouter(); const router = useRouter();
const isActive = router.pathname === pathname; const isActive = router.pathname === pathname;
const colors = useColors();
return ( return (
<NextLink href={ pathname } passHref> <NextLink href={ pathname } passHref>
<Link <Link
...@@ -21,9 +24,9 @@ const AccountNavLink = ({ text, pathname, icon }: Props) => { ...@@ -21,9 +24,9 @@ const AccountNavLink = ({ text, pathname, icon }: Props) => {
w="220px" w="220px"
px={ 4 } px={ 4 }
py={ 2.5 } py={ 2.5 }
color={ isActive ? 'blue.700' : 'gray.600' } color={ isActive ? colors.text.active : colors.text.default }
bgColor={ isActive ? 'blue.50' : 'transparent' } bgColor={ isActive ? colors.bg.active : colors.bg.default }
_hover={{ color: 'blue.400' }} _hover={{ color: colors.text.hover }}
borderRadius="base" borderRadius="base"
> >
<HStack spacing={ 3 }> <HStack spacing={ 3 }>
......
...@@ -3,6 +3,7 @@ import { Link, Icon, Text, HStack } from '@chakra-ui/react'; ...@@ -3,6 +3,7 @@ import { Link, Icon, Text, HStack } from '@chakra-ui/react';
import NextLink from 'next/link'; import NextLink from 'next/link';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { ChevronRightIcon } from '@chakra-ui/icons' import { ChevronRightIcon } from '@chakra-ui/icons'
import useColors from './useColors';
interface Props { interface Props {
pathname: string; pathname: string;
...@@ -14,6 +15,8 @@ const MainNavLink = ({ text, pathname, icon }: Props) => { ...@@ -14,6 +15,8 @@ const MainNavLink = ({ text, pathname, icon }: Props) => {
const router = useRouter(); const router = useRouter();
const isActive = router.pathname === pathname; const isActive = router.pathname === pathname;
const colors = useColors();
return ( return (
<NextLink href={ pathname } passHref> <NextLink href={ pathname } passHref>
<Link <Link
...@@ -22,10 +25,10 @@ const MainNavLink = ({ text, pathname, icon }: Props) => { ...@@ -22,10 +25,10 @@ const MainNavLink = ({ text, pathname, icon }: Props) => {
w="220px" w="220px"
px={ 4 } px={ 4 }
py={ 2.5 } py={ 2.5 }
color={ isActive ? 'blue.700' : 'gray.600' } color={ isActive ? colors.text.active : colors.text.default }
bgColor={ isActive ? 'blue.50' : 'transparent' } bgColor={ isActive ? colors.bg.active : colors.bg.default }
_hover={{ color: colors.text.hover }}
borderRadius="base" borderRadius="base"
_hover={{ color: 'blue.400' }}
> >
<HStack justifyContent="space-between"> <HStack justifyContent="space-between">
<HStack spacing={ 3 }> <HStack spacing={ 3 }>
......
import React from 'react'; import React from 'react';
import { VStack, Text, HStack, Icon, Link } from '@chakra-ui/react'; import { VStack, Text, HStack, Icon, Link, useColorModeValue } from '@chakra-ui/react';
import ghIcon from '../../icons/social/git.svg'; import ghIcon from '../../icons/social/git.svg';
import twIcon from '../../icons/social/tweet.svg'; import twIcon from '../../icons/social/tweet.svg';
...@@ -20,7 +20,7 @@ const NavFooter = () => { ...@@ -20,7 +20,7 @@ const NavFooter = () => {
as="footer" as="footer"
spacing={ 8 } spacing={ 8 }
borderTop="1px solid" borderTop="1px solid"
borderColor="gray.200" borderColor={ useColorModeValue('gray.200', 'whiteAlpha.200') }
paddingTop={ 8 } paddingTop={ 8 }
w="100%" w="100%"
alignItems="baseline" alignItems="baseline"
......
import React from 'react'; import React from 'react';
import { VStack, HStack, Icon } from '@chakra-ui/react'; import { VStack, HStack, Icon, useColorModeValue } from '@chakra-ui/react';
import AccountNavigation from './AccountNavigation'; import AccountNavigation from './AccountNavigation';
import MainNavigation from './MainNavigation'; import MainNavigation from './MainNavigation';
...@@ -14,14 +14,14 @@ const Navigation = () => { ...@@ -14,14 +14,14 @@ const Navigation = () => {
alignItems="flex-start" alignItems="flex-start"
spacing={ 12 } spacing={ 12 }
borderRight="1px solid" borderRight="1px solid"
borderColor="gray.200" borderColor={ useColorModeValue('gray.200', 'whiteAlpha.200') }
px={ 10 } px={ 10 }
py={ 12 } py={ 12 }
width="300px" width="300px"
> >
<HStack as="header" justifyContent="space-between" w="100%" px={ 4 } mb={ 2 } h={ 10 } alignItems="center"> <HStack as="header" justifyContent="space-between" w="100%" px={ 4 } mb={ 2 } h={ 10 } alignItems="center">
<Icon as={ logoIcon } width="142px" height="26px" color="blue.600"/> <Icon as={ logoIcon } width="142px" height="26px" color={ useColorModeValue('blue.600', 'white') }/>
<Icon as={ networksIcon } width="20px" height="20px"/> <Icon as={ networksIcon } width="20px" height="20px" color={ useColorModeValue('gray.500', 'white') }/>
</HStack> </HStack>
<MainNavigation/> <MainNavigation/>
<AccountNavigation/> <AccountNavigation/>
......
import { useColorModeValue } from '@chakra-ui/react';
export default function useColors() {
return {
text: {
'default': useColorModeValue('gray.600', 'gray.300'),
active: useColorModeValue('blue.700', 'gray.300'),
hover: useColorModeValue('blue.400', 'gray.100'),
},
bg: {
'default': 'transparent',
active: useColorModeValue('blue.50', 'gray.900'),
},
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment