diff --git a/src/@chakra-ui/gatsby-plugin/components/Breadcrumb.ts b/src/@chakra-ui/gatsby-plugin/components/Breadcrumb.ts new file mode 100644 index 00000000000..55fb739f902 --- /dev/null +++ b/src/@chakra-ui/gatsby-plugin/components/Breadcrumb.ts @@ -0,0 +1,45 @@ +import { createMultiStyleConfigHelpers } from "@chakra-ui/react" +import { breadcrumbAnatomy } from "@chakra-ui/anatomy" +import { breadcrumbDefaultTheme, defineMergeStyles } from "./components.utils" + +const { defineMultiStyleConfig } = createMultiStyleConfigHelpers( + breadcrumbAnatomy.keys +) + +const baseStyle = defineMergeStyles(breadcrumbDefaultTheme.baseStyle, { + list: { + m: 0, + lineHeight: "base", + flexWrap: "wrap", + }, + item: { + color: "body.medium", + letterSpacing: "wider", + m: 0, + }, + link: { + fontWeight: "normal", + _hover: { + color: "primary.base", + textDecor: "none", + }, + _active: { + color: "primary.base", + }, + /* + * `&[aria-current="page"]` + * Redundancy to ensure styling on the active + * link is applied. + */ + _activeLink: { + color: "primary.base", + }, + }, + separator: { + mx: "2.5", + }, +}) + +export const Breadcrumb = defineMultiStyleConfig({ + baseStyle, +}) diff --git a/src/@chakra-ui/gatsby-plugin/components/index.ts b/src/@chakra-ui/gatsby-plugin/components/index.ts index 58717a755af..2dd5ab689be 100644 --- a/src/@chakra-ui/gatsby-plugin/components/index.ts +++ b/src/@chakra-ui/gatsby-plugin/components/index.ts @@ -2,6 +2,7 @@ import { Alert } from "./Alert" import { Avatar } from "./Avatar" import { Badge } from "./Badge" import { Button } from "./Button" +import { Breadcrumb } from "./Breadcrumb" import { Heading } from "./Heading" import { Link } from "./Link" import { Tag } from "./Tag" @@ -17,7 +18,6 @@ import { Switch } from "./Switch" import { Input } from "./Input" import { accordionDefaultTheme, - breadcrumbDefaultTheme, closeButtonDefaultTheme, codeDefaultTheme, dividerDefaultTheme, @@ -34,7 +34,7 @@ export default { Alert, Avatar, Badge, - Breadcrumb: breadcrumbDefaultTheme, + Breadcrumb, Button, Checkbox, CloseButton: closeButtonDefaultTheme, diff --git a/src/components/Breadcrumbs/Breadcrumbs.stories.tsx b/src/components/Breadcrumbs/Breadcrumbs.stories.tsx index 3d7e3eff0ea..034e9e97d37 100644 --- a/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +++ b/src/components/Breadcrumbs/Breadcrumbs.stories.tsx @@ -1,5 +1,6 @@ import * as React from "react" import { Meta, StoryObj } from "@storybook/react" +import { Stack } from "@chakra-ui/react" import BreadcrumbsComponent from "." type BreadcumbsType = typeof BreadcrumbsComponent @@ -15,10 +16,10 @@ type Story = StoryObj export const Breadcrumbs: Story = { render: () => ( - <> + - + ), } diff --git a/src/components/Breadcrumbs/index.tsx b/src/components/Breadcrumbs/index.tsx index 81df5a7106c..d5269e15dce 100644 --- a/src/components/Breadcrumbs/index.tsx +++ b/src/components/Breadcrumbs/index.tsx @@ -68,45 +68,15 @@ const Breadcrumbs: React.FC = ({ .slice(startDepth) return ( - + {crumbs.map((crumb, idx) => { const isCurrentPage = slug === crumb.fullPath return ( - + {crumb.text.toUpperCase()} diff --git a/src/pages/bug-bounty.tsx b/src/pages/bug-bounty.tsx index 990de18b32a..1743c9a2717 100644 --- a/src/pages/bug-bounty.tsx +++ b/src/pages/bug-bounty.tsx @@ -442,7 +442,7 @@ const BugBountiesPage = ({ - + diff --git a/src/pages/roadmap/vision.tsx b/src/pages/roadmap/vision.tsx index 9153044aa2b..60e5bc7f8ef 100644 --- a/src/pages/roadmap/vision.tsx +++ b/src/pages/roadmap/vision.tsx @@ -47,7 +47,7 @@ const PageDivider = () => ( ) const PageContent = (props: ChildOnlyProp) => ( - <Box py={4} px={8} w="full" {...props} /> + <Flex flexDirection="column" gap="8" py={4} px={8} w="full" {...props} /> ) const H2 = (props: HeadingProps) => ( diff --git a/src/templates/roadmap.tsx b/src/templates/roadmap.tsx index ce9a7e92dbe..c1227e48834 100644 --- a/src/templates/roadmap.tsx +++ b/src/templates/roadmap.tsx @@ -219,7 +219,7 @@ const RoadmapPage = ({ <HeroContainer> <Flex w="100%" flexDirection={{ base: "column", md: "row" }}> <TitleCard> - <Breadcrumbs slug={location.pathname} /> + <Breadcrumbs slug={location.pathname} mb="8" /> <Title>{mdx.frontmatter.title} {mdx.frontmatter.description} {mdx?.frontmatter?.buttons && ( diff --git a/src/templates/staking.tsx b/src/templates/staking.tsx index 6291a47a69c..ddf625495ee 100644 --- a/src/templates/staking.tsx +++ b/src/templates/staking.tsx @@ -401,7 +401,7 @@ const StakingPage = ({ - + {mdx.frontmatter.title} {(summaryPoints || []).map((point, idx) => ( diff --git a/src/templates/static.tsx b/src/templates/static.tsx index 4ddba8dbbf5..b3ab775fdd1 100644 --- a/src/templates/static.tsx +++ b/src/templates/static.tsx @@ -285,7 +285,7 @@ const StaticPage = ({ }, }} > - + - + {mdx.frontmatter.title}