Skip to content

Commit 07d0502

Browse files
authored
Merge pull request #13058 from alex1092/back-to-top-button
adds back to top button [Fixes #12194]
2 parents 264ff32 + bd89e9c commit 07d0502

File tree

2 files changed

+70
-42
lines changed

2 files changed

+70
-42
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ robots.txt
5050
# .crowdin folder used as temp forlder for crowdin-import script
5151
.crowdin
5252

53-
# vscode workplace configuration
53+
# workplace configuration
5454
.vscode
55+
.idea
5556

5657
# Crowdin report output
5758
src/data/crowdin/bucketsAwaitingReviewReport.csv

src/components/Footer.tsx

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useRouter } from "next/router"
22
import { useTranslation } from "next-i18next"
33
import { FaDiscord, FaGithub, FaTwitter } from "react-icons/fa"
4+
import { IoChevronUpSharp } from "react-icons/io5"
45
import {
56
Box,
67
Flex,
@@ -17,8 +18,11 @@ import type { FooterLink, FooterLinkSection, Lang } from "@/lib/types"
1718
import { BaseLink } from "@/components/Link"
1819
import Translation from "@/components/Translation"
1920

21+
import { scrollIntoView } from "@/lib/utils/scrollIntoView"
2022
import { getLocaleTimestamp } from "@/lib/utils/time"
2123

24+
import { Button } from "./Buttons"
25+
2226
const socialLinks = [
2327
{
2428
icon: FaGithub,
@@ -331,40 +335,32 @@ const Footer = ({ lastDeployDate }: FooterProps) => {
331335
return (
332336
<Box as="footer" py="4" px="8">
333337
<Flex
334-
fontSize="md"
335-
justify="space-between"
338+
justify={{ base: "center", md: 'space-between'}}
336339
alignItems="center"
337340
flexWrap="wrap"
341+
gap={8}
342+
pt={4}
343+
pb={4}
344+
borderTop={"1px solid"}
345+
borderColor={"body.light"}
338346
>
339347
{lastDeployDate && (
340-
<Text>
348+
<Text fontSize={"sm"} fontStyle={"italic"} color={"body.medium"}>
341349
<Translation id="website-last-updated" />:{" "}
342350
{getLocaleTimestamp(locale as Lang, lastDeployDate)}
343351
</Text>
344352
)}
345-
<Box my={4}>
346-
{socialLinks.map(({ to, ariaLabel, icon }) => (
347-
<BaseLink
348-
key={to}
349-
href={to}
350-
hideArrow
351-
color="body.base"
352-
aria-label={ariaLabel}
353-
ms="4"
354-
_focus={{ color: "primary.base" }}
355-
>
356-
<Icon
357-
as={icon}
358-
_hover={{
359-
transition:
360-
"color 0.2s ease-in-out, transform 0.2s ease-in-out",
361-
}}
362-
fontSize="4xl"
363-
/>
364-
</BaseLink>
365-
))}
366-
</Box>
353+
354+
<Button
355+
leftIcon={<IoChevronUpSharp />}
356+
variant="outline"
357+
isSecondary
358+
onClick={() => scrollIntoView("__next")}
359+
>
360+
Go to top
361+
</Button>
367362
</Flex>
363+
368364
<SimpleGrid
369365
gap={4}
370366
justifyContent="space-between"
@@ -392,27 +388,58 @@ const Footer = ({ lastDeployDate }: FooterProps) => {
392388
</Box>
393389
))}
394390
</SimpleGrid>
395-
<List
396-
display="flex"
397-
flexWrap="wrap"
391+
<Flex
392+
p={6}
393+
flexDir="column"
394+
alignItems="center"
398395
justifyContent="center"
399-
my="6"
400-
mx="0"
401-
py="8"
402-
px="2"
403-
lineHeight="base"
404-
fontWeight="normal"
405396
fontSize="sm"
406397
bg="background.highlight"
407398
>
408-
{dipperLinks.map(({ to, text }) => (
409-
<ListItem key={text} p="2" m="0">
410-
<BaseLink href={to} {...linkProps}>
411-
{text}
399+
<Box display="flex" gap={4}>
400+
{socialLinks.map(({ to, ariaLabel, icon }) => (
401+
<BaseLink
402+
key={to}
403+
href={to}
404+
hideArrow
405+
color="body.base"
406+
aria-label={ariaLabel}
407+
_focus={{ color: "primary.base" }}
408+
>
409+
<Icon
410+
as={icon}
411+
_hover={{
412+
transition:
413+
"color 0.2s ease-in-out, transform 0.2s ease-in-out",
414+
}}
415+
fontSize="4xl"
416+
/>
412417
</BaseLink>
413-
</ListItem>
414-
))}
415-
</List>
418+
))}
419+
</Box>
420+
<List
421+
display="flex"
422+
flexDir={{ base: "column", sm: "row" }}
423+
flexWrap="wrap"
424+
justifyContent={{ base: "center", sm: "space-between", md: "center" }}
425+
fontWeight="normal"
426+
fontSize="sm"
427+
p={5}
428+
m={0}
429+
>
430+
{dipperLinks.map(({ to, text }) => (
431+
<ListItem
432+
key={text}
433+
textAlign="center"
434+
px="2"
435+
>
436+
<BaseLink href={to} w={["100%", null]} {...linkProps}>
437+
{text}
438+
</BaseLink>
439+
</ListItem>
440+
))}
441+
</List>
442+
</Flex>
416443
</Box>
417444
)
418445
}

0 commit comments

Comments
 (0)