|
1 | 1 | import React from "react"
|
2 |
| -import styled from "@emotion/styled" |
3 | 2 | import { useIntl } from "react-intl"
|
4 | 3 |
|
5 | 4 | import Link from "./Link"
|
6 | 5 | import { isLang, supportedLanguages } from "../utils/languages"
|
7 | 6 | import { isTranslationKey, translateMessageId } from "../utils/translations"
|
8 |
| - |
9 |
| -const ListContainer = styled.nav` |
10 |
| - margin-bottom: 2rem; |
11 |
| - list-style-type: none; |
12 |
| - /* Avoid header overlap: */ |
13 |
| - position: relative; |
14 |
| - z-index: 1; |
15 |
| -` |
16 |
| - |
17 |
| -const List = styled.ol` |
18 |
| - margin: 0; |
19 |
| - list-style-type: none; |
20 |
| - display: flex; |
21 |
| - flex-wrap: wrap; |
22 |
| -` |
23 |
| - |
24 |
| -const ListItem = styled.li` |
25 |
| - margin: 0; |
26 |
| - margin-right: 0.5rem; |
27 |
| - font-size: 0.875rem; |
28 |
| - line-height: 140%; |
29 |
| - letter-spacing: 0.04em; |
30 |
| -` |
31 |
| - |
32 |
| -const Slash = styled.span` |
33 |
| - margin-left: 0.5rem; |
34 |
| - color: ${(props) => props.theme.colors.textTableOfContents}; |
35 |
| -` |
36 |
| - |
37 |
| -const CrumbLink = styled(Link)` |
38 |
| - text-decoration: none; |
39 |
| - color: ${(props) => props.theme.colors.textTableOfContents}; |
40 |
| -
|
41 |
| - &:hover { |
42 |
| - text-decoration: none; |
43 |
| - color: ${(props) => props.theme.colors.primary}; |
44 |
| - } |
45 |
| -
|
46 |
| - &.active { |
47 |
| - color: ${(props) => props.theme.colors.primary}; |
48 |
| - } |
49 |
| -` |
| 7 | +import { Box, UnorderedList, ListItem } from "@chakra-ui/react" |
| 8 | +import ButtonLink from "./ButtonLink" |
50 | 9 |
|
51 | 10 | export interface IProps {
|
52 | 11 | slug: string
|
@@ -91,21 +50,51 @@ const Breadcrumbs: React.FC<IProps> = ({
|
91 | 50 | })
|
92 | 51 |
|
93 | 52 | return (
|
94 |
| - <ListContainer aria-label="Breadcrumb" dir="auto" {...restProps}> |
95 |
| - <List> |
| 53 | + <Box |
| 54 | + aria-label="Breadcrumb" |
| 55 | + dir="auto" |
| 56 | + {...restProps} |
| 57 | + as="nav" |
| 58 | + marginBottom={8} |
| 59 | + listStyleType="none" |
| 60 | + position="relative" |
| 61 | + zIndex={1} |
| 62 | + > |
| 63 | + <UnorderedList |
| 64 | + display="flex" |
| 65 | + flexWrap="wrap" |
| 66 | + listStyleType="none" |
| 67 | + margin={0} |
| 68 | + > |
96 | 69 | {crumbs.map((crumb, idx) => (
|
97 |
| - <ListItem key={idx}> |
98 |
| - <CrumbLink |
| 70 | + <ListItem |
| 71 | + key={idx} |
| 72 | + margin={0} |
| 73 | + marginRight={2} |
| 74 | + fontSize="sm" |
| 75 | + lineHeight="140%" |
| 76 | + letterSpacing="wider" |
| 77 | + > |
| 78 | + <ButtonLink |
| 79 | + as={Link} |
99 | 80 | to={crumb.fullPath}
|
100 | 81 | isPartiallyActive={slug === crumb.fullPath}
|
| 82 | + textDecoration="none" |
| 83 | + color="textTableOfContents" |
| 84 | + _hover={{ color: "primary", textDecor: "none" }} |
| 85 | + _active={{ color: "primary" }} |
101 | 86 | >
|
102 | 87 | {crumb.text}
|
103 |
| - </CrumbLink> |
104 |
| - {idx < crumbs.length - 1 && <Slash>/</Slash>} |
| 88 | + </ButtonLink> |
| 89 | + {idx < crumbs.length - 1 && ( |
| 90 | + <Box as="span" marginLeft={2} color="textTableOfContents"> |
| 91 | + / |
| 92 | + </Box> |
| 93 | + )} |
105 | 94 | </ListItem>
|
106 | 95 | ))}
|
107 |
| - </List> |
108 |
| - </ListContainer> |
| 96 | + </UnorderedList> |
| 97 | + </Box> |
109 | 98 | )
|
110 | 99 | }
|
111 | 100 |
|
|
0 commit comments