Skip to content

Commit 98b9ce0

Browse files
committed
pull color mode hooks from render
1 parent 3eb997a commit 98b9ce0

File tree

2 files changed

+20
-29
lines changed

2 files changed

+20
-29
lines changed

src/components/Contact/index.tsx

+16-24
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,20 @@ const CONFETTI_DARK = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2
3434
function Contact() {
3535
const { hasCopied, onCopy } = useClipboard(process.env.NEXT_PUBLIC_EMAIL);
3636

37+
const bgColor = useColorModeValue('white', 'gray.800');
38+
const bgImage = useColorModeValue(CONFETTI_LIGHT, CONFETTI_DARK);
39+
const btnHoverColor = useColorModeValue('white', 'gray.700');
40+
41+
const formBg = useColorModeValue('white', 'gray.700');
42+
const formColor = useColorModeValue('gray.700', 'whiteAlpha.900');
43+
3744
return (
3845
<Flex
39-
bg={useColorModeValue('white', 'gray.800')}
46+
bg={bgColor}
4047
align="center"
4148
justify="center"
4249
css={{
43-
backgroundImage: useColorModeValue(
44-
CONFETTI_LIGHT,
45-
CONFETTI_DARK
46-
),
50+
backgroundImage: bgImage,
4751
backgroundAttachment: 'fixed',
4852
}}
4953
>
@@ -88,11 +92,8 @@ function Contact() {
8892
fontSize="3xl"
8993
icon={<MdEmail />}
9094
_hover={{
91-
bg: 'blue.500',
92-
color: useColorModeValue(
93-
'white',
94-
'gray.700'
95-
),
95+
bg: 'green.500',
96+
color: btnHoverColor,
9697
}}
9798
onClick={onCopy}
9899
isRound
@@ -107,11 +108,8 @@ function Contact() {
107108
fontSize="3xl"
108109
icon={<BsGithub />}
109110
_hover={{
110-
bg: 'blue.500',
111-
color: useColorModeValue(
112-
'white',
113-
'gray.700'
114-
),
111+
bg: 'black',
112+
color: btnHoverColor,
115113
}}
116114
isRound
117115
/>
@@ -125,24 +123,18 @@ function Contact() {
125123
icon={<BsLinkedin size="28px" />}
126124
_hover={{
127125
bg: 'blue.500',
128-
color: useColorModeValue(
129-
'white',
130-
'gray.700'
131-
),
126+
color: btnHoverColor,
132127
}}
133128
isRound
134129
/>
135130
</ExternalLink>
136131
</Stack>
137132

138133
<Box
139-
bg={useColorModeValue('white', 'gray.700')}
134+
bg={formBg}
140135
borderRadius="lg"
141136
p={8}
142-
color={useColorModeValue(
143-
'gray.700',
144-
'whiteAlpha.900'
145-
)}
137+
color={formColor}
146138
shadow="dark-lg"
147139
>
148140
<ContactForm />

src/components/Layout/extra/Link.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ import { useRouter } from 'next/router';
55

66
function Link({ children, href, ...props }) {
77
const { asPath: currentPath } = useRouter();
8+
const bgColor = useColorModeValue('gray.100', 'gray.700');
9+
const hoverBgColor = useColorModeValue('gray.200', 'gray.700');
810

911
return (
1012
<NextLink href={href} passHref>
1113
<ChakraLink
1214
as="div"
13-
bg={
14-
href === currentPath &&
15-
useColorModeValue('gray.100', 'gray.700')
16-
}
15+
bg={href === currentPath ? bgColor : undefined}
1716
_hover={{
1817
textDecoration: 'none',
19-
bg: useColorModeValue('gray.200', 'gray.700'),
18+
bg: hoverBgColor,
2019
}}
2120
p={2}
2221
rounded={'md'}

0 commit comments

Comments
 (0)