|
| 1 | +import { |
| 2 | + Box, |
| 3 | + Flex, |
| 4 | + Heading, |
| 5 | + Icon, |
| 6 | + List, |
| 7 | + ListItem, |
| 8 | + SimpleGrid, |
| 9 | + useToken, |
| 10 | +} from "@chakra-ui/react" |
| 11 | +import { graphql, StaticQuery } from "gatsby" |
1 | 12 | import React from "react"
|
2 |
| -import styled from "@emotion/styled" |
| 13 | +import { FaGithub, FaTwitter, FaYoutube, FaDiscord } from "react-icons/fa" |
3 | 14 | import { useIntl } from "react-intl"
|
4 |
| -import { StaticQuery, graphql } from "gatsby" |
5 |
| -import { Icon } from "@chakra-ui/react" |
6 |
| -import { FaDiscord, FaGithub, FaTwitter, FaYoutube } from "react-icons/fa" |
7 |
| - |
| 15 | +import { Lang } from "../utils/languages" |
8 | 16 | import { getLocaleTimestamp } from "../utils/time"
|
9 |
| -import Translation from "./Translation" |
10 |
| -import Link from "./Link" |
11 | 17 | import { isLangRightToLeft, TranslationKey } from "../utils/translations"
|
12 |
| -import { Lang } from "../utils/languages" |
13 |
| - |
14 |
| -const StyledFooter = styled.footer` |
15 |
| - padding-top: 3rem; |
16 |
| - padding-bottom: 4rem; |
17 |
| - padding: 1rem 2rem; |
18 |
| -` |
19 |
| - |
20 |
| -const FooterTop = styled.div` |
21 |
| - font-size: ${(props) => props.theme.fontSizes.s}; |
22 |
| - display: flex; |
23 |
| - justify-content: space-between; |
24 |
| - align-items: center; |
25 |
| - flex-wrap: wrap; |
26 |
| -` |
27 |
| - |
28 |
| -const LastUpdated = styled.div` |
29 |
| - color: ${(props) => props.theme.colors.text200}; |
30 |
| -` |
31 |
| - |
32 |
| -const LinkGrid = styled.div` |
33 |
| - display: grid; |
34 |
| - grid-template-columns: repeat(6, auto); |
35 |
| - grid-gap: 1rem; |
36 |
| - justify-content: space-between; |
37 |
| - @media (max-width: 1300px) { |
38 |
| - grid-template-columns: repeat(3, auto); |
39 |
| - } |
40 |
| - @media (max-width: ${(props) => props.theme.breakpoints.m}) { |
41 |
| - grid-template-columns: repeat(2, auto); |
42 |
| - } |
43 |
| - @media (max-width: 500px) { |
44 |
| - grid-template-columns: auto; |
45 |
| - } |
46 |
| -` |
47 |
| - |
48 |
| -const LinkSection = styled.div`` |
49 |
| - |
50 |
| -const SectionHeader = styled.h3` |
51 |
| - font-size: 0.875rem; |
52 |
| - line-height: 1.6; |
53 |
| - margin: 1.14em 0; |
54 |
| - font-weight: bold; |
55 |
| -` |
56 |
| - |
57 |
| -const List = styled.ul` |
58 |
| - font-size: 0.875rem; |
59 |
| - line-height: 1.6; |
60 |
| - font-weight: 400; |
61 |
| - margin: 0; |
62 |
| - list-style-type: none; |
63 |
| - list-style-image: none; |
64 |
| -` |
65 |
| - |
66 |
| -const ListItem = styled.li` |
67 |
| - margin-bottom: 1rem; |
68 |
| -` |
69 |
| - |
70 |
| -const FooterLink = styled(Link)` |
71 |
| - text-decoration: none; |
72 |
| - color: ${(props) => props.theme.colors.text200}; |
73 |
| - svg { |
74 |
| - fill: ${(props) => props.theme.colors.text200}; |
75 |
| - } |
76 |
| - &:after { |
77 |
| - color: ${(props) => props.theme.colors.text200}; |
78 |
| - } |
79 |
| - &:hover { |
80 |
| - text-decoration: none; |
81 |
| - color: ${(props) => props.theme.colors.primary}; |
82 |
| - &:after { |
83 |
| - color: ${(props) => props.theme.colors.primary}; |
84 |
| - } |
85 |
| - svg { |
86 |
| - fill: ${(props) => props.theme.colors.primary}; |
87 |
| - } |
88 |
| - } |
89 |
| -` |
90 |
| - |
91 |
| -const SocialIcons = styled.div` |
92 |
| - margin: 1rem 0; |
93 |
| -` |
94 |
| -const SocialIcon = styled(Icon)` |
95 |
| - margin-left: 1rem; |
96 |
| - width: 2rem; |
97 |
| -
|
98 |
| - @media (max-width: ${(props) => props.theme.breakpoints.s}) { |
99 |
| - margin-left: 0; |
100 |
| - margin-right: 0.5rem; |
101 |
| - } |
102 |
| -` |
| 18 | +import Link from "./Link" |
| 19 | +import Translation from "./Translation" |
103 | 20 |
|
104 | 21 | const socialLinks = [
|
105 | 22 | {
|
@@ -140,6 +57,8 @@ const Footer: React.FC<IProps> = () => {
|
140 | 57 |
|
141 | 58 | const isPageRightToLeft = isLangRightToLeft(intl.locale as Lang)
|
142 | 59 |
|
| 60 | + const [medBp] = useToken("breakpoints", ["md"]) |
| 61 | + |
143 | 62 | const linkSections: Array<LinkSection> = [
|
144 | 63 | {
|
145 | 64 | title: "use-ethereum",
|
@@ -372,54 +291,91 @@ const Footer: React.FC<IProps> = () => {
|
372 | 291 | }
|
373 | 292 | `}
|
374 | 293 | render={(data) => (
|
375 |
| - <StyledFooter> |
376 |
| - <FooterTop> |
377 |
| - <LastUpdated> |
| 294 | + <Box as="footer" p="1rem 2rem"> |
| 295 | + <Flex |
| 296 | + fontSize="sm" |
| 297 | + justify="space-between" |
| 298 | + alignItems="center" |
| 299 | + flexWrap="wrap" |
| 300 | + > |
| 301 | + <Box color="text200"> |
378 | 302 | <Translation id="website-last-updated" />:{" "}
|
379 | 303 | {getLocaleTimestamp(
|
380 | 304 | intl.locale as Lang,
|
381 | 305 | data.allSiteBuildMetadata.edges[0].node.buildTime
|
382 | 306 | )}
|
383 |
| - </LastUpdated> |
384 |
| - <SocialIcons> |
385 |
| - {socialLinks.map((link, idx) => { |
| 307 | + </Box> |
| 308 | + <Box my={4}> |
| 309 | + {socialLinks.map((link, idk) => { |
386 | 310 | return (
|
387 | 311 | <Link
|
388 |
| - key={idx} |
| 312 | + key={idk} |
389 | 313 | to={link.to}
|
390 |
| - hideArrow={true} |
| 314 | + hideArrow |
391 | 315 | color="secondary"
|
392 | 316 | aria-label={link.ariaLabel}
|
393 | 317 | >
|
394 | 318 | <Icon as={link.icon} fontSize="4xl" ml={4} />
|
395 | 319 | </Link>
|
396 | 320 | )
|
397 | 321 | })}
|
398 |
| - </SocialIcons> |
399 |
| - </FooterTop> |
400 |
| - <LinkGrid> |
| 322 | + </Box> |
| 323 | + </Flex> |
| 324 | + <SimpleGrid |
| 325 | + gap={4} |
| 326 | + justifyContent="space-between" |
| 327 | + gridTemplateColumns="repeat(6, auto)" |
| 328 | + sx={{ |
| 329 | + "@media (max-width: 1300px)": { |
| 330 | + gridTemplateColumns: "repeat(3, auto)", |
| 331 | + }, |
| 332 | + [`@media (max-width: ${medBp})`]: { |
| 333 | + gridTemplateColumns: "repeat(2, auto)", |
| 334 | + }, |
| 335 | + "@media (max-width: 500px)": { |
| 336 | + gridTemplateColumns: "auto", |
| 337 | + }, |
| 338 | + }} |
| 339 | + > |
401 | 340 | {linkSections.map((section: LinkSection, idx) => (
|
402 |
| - <LinkSection key={idx}> |
403 |
| - <SectionHeader> |
| 341 | + <Box key={idx}> |
| 342 | + <Heading as="h3" fontSize="sm" lineHeight="1.6" my="1.14em"> |
404 | 343 | <Translation id={section.title} />
|
405 |
| - </SectionHeader> |
406 |
| - <List> |
| 344 | + </Heading> |
| 345 | + <List fontSize="sm" lineHeight="1.6" fontWeight="400" m={0}> |
407 | 346 | {section.links.map((link, linkIdx) => (
|
408 |
| - <ListItem key={linkIdx}> |
409 |
| - <FooterLink |
410 |
| - dir={isPageRightToLeft ? "auto" : "ltr"} |
| 347 | + <ListItem key={linkIdx} mb={4}> |
| 348 | + <Link |
411 | 349 | to={link.to}
|
412 | 350 | isPartiallyActive={false}
|
| 351 | + dir={isPageRightToLeft ? "auto" : "ltr"} |
| 352 | + textDecor="none" |
| 353 | + color="text200" |
| 354 | + _hover={{ |
| 355 | + textDecor: "none", |
| 356 | + color: "primary", |
| 357 | + _after: { |
| 358 | + color: "primary", |
| 359 | + }, |
| 360 | + "& svg": { |
| 361 | + fill: "primary", |
| 362 | + }, |
| 363 | + }} |
| 364 | + sx={{ |
| 365 | + "& svg": { |
| 366 | + fill: "text200", |
| 367 | + }, |
| 368 | + }} |
413 | 369 | >
|
414 | 370 | <Translation id={link.text} />
|
415 |
| - </FooterLink> |
| 371 | + </Link> |
416 | 372 | </ListItem>
|
417 | 373 | ))}
|
418 | 374 | </List>
|
419 |
| - </LinkSection> |
| 375 | + </Box> |
420 | 376 | ))}
|
421 |
| - </LinkGrid> |
422 |
| - </StyledFooter> |
| 377 | + </SimpleGrid> |
| 378 | + </Box> |
423 | 379 | )}
|
424 | 380 | />
|
425 | 381 | )
|
|
0 commit comments