File tree Expand file tree Collapse file tree 10 files changed +58
-42
lines changed
@chakra-ui/gatsby-plugin/components Expand file tree Collapse file tree 10 files changed +58
-42
lines changed Original file line number Diff line number Diff line change
1
+ import { createMultiStyleConfigHelpers } from "@chakra-ui/react"
2
+ import { breadcrumbAnatomy } from "@chakra-ui/anatomy"
3
+ import { breadcrumbDefaultTheme , defineMergeStyles } from "./components.utils"
4
+
5
+ const { defineMultiStyleConfig } = createMultiStyleConfigHelpers (
6
+ breadcrumbAnatomy . keys
7
+ )
8
+
9
+ const baseStyle = defineMergeStyles ( breadcrumbDefaultTheme . baseStyle , {
10
+ list : {
11
+ m : 0 ,
12
+ lineHeight : "base" ,
13
+ flexWrap : "wrap" ,
14
+ } ,
15
+ item : {
16
+ color : "body.medium" ,
17
+ letterSpacing : "wider" ,
18
+ m : 0 ,
19
+ } ,
20
+ link : {
21
+ fontWeight : "normal" ,
22
+ _hover : {
23
+ color : "primary.base" ,
24
+ textDecor : "none" ,
25
+ } ,
26
+ _active : {
27
+ color : "primary.base" ,
28
+ } ,
29
+ /*
30
+ * `&[aria-current="page"]`
31
+ * Redundancy to ensure styling on the active
32
+ * link is applied.
33
+ */
34
+ _activeLink : {
35
+ color : "primary.base" ,
36
+ } ,
37
+ } ,
38
+ separator : {
39
+ mx : "2.5" ,
40
+ } ,
41
+ } )
42
+
43
+ export const Breadcrumb = defineMultiStyleConfig ( {
44
+ baseStyle,
45
+ } )
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { Alert } from "./Alert"
2
2
import { Avatar } from "./Avatar"
3
3
import { Badge } from "./Badge"
4
4
import { Button } from "./Button"
5
+ import { Breadcrumb } from "./Breadcrumb"
5
6
import { Heading } from "./Heading"
6
7
import { Link } from "./Link"
7
8
import { Tag } from "./Tag"
@@ -17,7 +18,6 @@ import { Switch } from "./Switch"
17
18
import { Input } from "./Input"
18
19
import {
19
20
accordionDefaultTheme ,
20
- breadcrumbDefaultTheme ,
21
21
closeButtonDefaultTheme ,
22
22
codeDefaultTheme ,
23
23
dividerDefaultTheme ,
@@ -34,7 +34,7 @@ export default {
34
34
Alert,
35
35
Avatar,
36
36
Badge,
37
- Breadcrumb : breadcrumbDefaultTheme ,
37
+ Breadcrumb,
38
38
Button,
39
39
Checkbox,
40
40
CloseButton : closeButtonDefaultTheme ,
Original file line number Diff line number Diff line change 1
1
import * as React from "react"
2
2
import { Meta , StoryObj } from "@storybook/react"
3
+ import { Stack } from "@chakra-ui/react"
3
4
import BreadcrumbsComponent from "."
4
5
5
6
type BreadcumbsType = typeof BreadcrumbsComponent
@@ -15,10 +16,10 @@ type Story = StoryObj<typeof meta>
15
16
16
17
export const Breadcrumbs : Story = {
17
18
render : ( ) => (
18
- < >
19
+ < Stack spacing = "8" >
19
20
< BreadcrumbsComponent slug = "/en/staking/" />
20
21
< BreadcrumbsComponent slug = "/en/staking/solo/" />
21
22
< BreadcrumbsComponent slug = "/en/roadmap/merge/issuance/" />
22
- </ >
23
+ </ Stack >
23
24
) ,
24
25
}
Original file line number Diff line number Diff line change @@ -68,45 +68,15 @@ const Breadcrumbs: React.FC<IProps> = ({
68
68
. slice ( startDepth )
69
69
70
70
return (
71
- < Breadcrumb
72
- dir = "auto"
73
- position = "relative"
74
- zIndex = "1"
75
- mb = { 8 }
76
- spacing = "2.5"
77
- listProps = { {
78
- m : 0 ,
79
- lineHeight : 1.6 ,
80
- flexWrap : "wrap" ,
81
- } }
82
- { ...restProps }
83
- >
71
+ < Breadcrumb dir = "auto" { ...restProps } >
84
72
{ crumbs . map ( ( crumb , idx ) => {
85
73
const isCurrentPage = slug === crumb . fullPath
86
74
return (
87
- < BreadcrumbItem
88
- key = { idx }
89
- isCurrentPage = { isCurrentPage }
90
- color = "body.medium"
91
- letterSpacing = "wider"
92
- m = { 0 }
93
- >
75
+ < BreadcrumbItem key = { idx } isCurrentPage = { isCurrentPage } >
94
76
< BreadcrumbLink
95
77
as = { BaseLink }
96
78
to = { crumb . fullPath }
97
79
isPartiallyActive = { isCurrentPage }
98
- fontWeight = "normal"
99
- _hover = { { color : "primary.base" , textDecor : "none" } }
100
- _active = { { color : "primary.base" } }
101
- sx = { {
102
- /*
103
- * Redundancy to ensure styling on the active
104
- * link is applied.
105
- */
106
- '&[aria-current="page"]' : {
107
- color : "primary.base" ,
108
- } ,
109
- } }
110
80
>
111
81
{ crumb . text . toUpperCase ( ) }
112
82
</ BreadcrumbLink >
Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ const BugBountiesPage = ({
442
442
< Content >
443
443
< HeroCard >
444
444
< HeroContainer >
445
- < Breadcrumbs slug = { location . pathname } />
445
+ < Breadcrumbs slug = { location . pathname } mb = "8" />
446
446
< Row >
447
447
< On />
448
448
< Title >
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ const PageDivider = () => (
47
47
)
48
48
49
49
const PageContent = ( props : ChildOnlyProp ) => (
50
- < Box py = { 4 } px = { 8 } w = "full" { ...props } />
50
+ < Flex flexDirection = "column" gap = "8" py = { 4 } px = { 8 } w = "full" { ...props } />
51
51
)
52
52
53
53
const H2 = ( props : HeadingProps ) => (
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ const RoadmapPage = ({
219
219
< HeroContainer >
220
220
< Flex w = "100%" flexDirection = { { base : "column" , md : "row" } } >
221
221
< TitleCard >
222
- < Breadcrumbs slug = { location . pathname } />
222
+ < Breadcrumbs slug = { location . pathname } mb = "8" />
223
223
< Title > { mdx . frontmatter . title } </ Title >
224
224
< Text > { mdx . frontmatter . description } </ Text >
225
225
{ mdx ?. frontmatter ?. buttons && (
Original file line number Diff line number Diff line change @@ -401,7 +401,7 @@ const StakingPage = ({
401
401
< Box position = "relative" width = "full" >
402
402
< HeroContainer >
403
403
< Flex direction = "column" justify = "flex-start" w = "full" p = { 8 } >
404
- < Breadcrumbs slug = { location . pathname } />
404
+ < Breadcrumbs slug = { location . pathname } mb = "8" />
405
405
< Title > { mdx . frontmatter . title } </ Title >
406
406
< UnorderedList >
407
407
{ ( summaryPoints || [ ] ) . map ( ( point , idx ) => (
Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ const StaticPage = ({
285
285
} ,
286
286
} }
287
287
>
288
- < Breadcrumbs slug = { slug } />
288
+ < Breadcrumbs slug = { slug } mb = "8" />
289
289
< Text
290
290
color = "text200"
291
291
dir = { isLangRightToLeft ( language as Lang ) ? "rtl" : "ltr" }
Original file line number Diff line number Diff line change @@ -382,7 +382,7 @@ const UpgradePage = ({
382
382
< Container >
383
383
< HeroContainer >
384
384
< TitleCard >
385
- < Breadcrumbs slug = { slug } startDepth = { 1 } mt = { 2 } />
385
+ < Breadcrumbs slug = { slug } startDepth = { 1 } mt = { 2 } mb = "8" />
386
386
< Title > { mdx . frontmatter . title } </ Title >
387
387
< Box >
388
388
< List listStyleType = "disc" >
You can’t perform that action at this time.
0 commit comments