Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Breadcrumbs): update component for new DS #10598

Merged
merged 6 commits into from
Aug 9, 2023
24 changes: 24 additions & 0 deletions src/components/Breadcrumbs/Breadcrumbs.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from "react"
import { Meta, StoryObj } from "@storybook/react"
import BreadcrumbsComponent from "."

type BreadcumbsType = typeof BreadcrumbsComponent

const meta: Meta<BreadcumbsType> = {
title: "Molecules / Navigation / Breadcrumbs",
component: BreadcrumbsComponent,
}

export default meta

type Story = StoryObj<typeof meta>

export const Breadcrumbs: Story = {
render: () => (
<>
<BreadcrumbsComponent slug="/en/staking/" />
<BreadcrumbsComponent slug="/en/staking/solo/" />
<BreadcrumbsComponent slug="/en/roadmap/merge/issuance/" />
</>
),
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
BreadcrumbProps,
} from "@chakra-ui/react"

import Link from "./Link"
import Link from "../Link"

export interface IProps extends BreadcrumbProps {
slug: string
Expand Down Expand Up @@ -73,10 +73,10 @@ const Breadcrumbs: React.FC<IProps> = ({
position="relative"
zIndex="1"
mb={8}
spacing="2.5"
listProps={{
m: 0,
lineHeight: 1,
rowGap: 1.5,
lineHeight: 1.6,
flexWrap: "wrap",
}}
{...restProps}
Expand All @@ -87,10 +87,8 @@ const Breadcrumbs: React.FC<IProps> = ({
<BreadcrumbItem
key={idx}
isCurrentPage={isCurrentPage}
color="textTableOfContents"
fontSize="sm"
color="body.medium"
letterSpacing="wider"
lineHeight="140%"
m={0}
>
<BreadcrumbLink
Expand All @@ -99,6 +97,15 @@ const Breadcrumbs: React.FC<IProps> = ({
isPartiallyActive={isCurrentPage}
_hover={{ color: "primary.base", textDecor: "none" }}
_active={{ color: "primary.base" }}
sx={{
/*
* Redundancy to ensure styling on the active
* link is applied.
*/
'&[aria-current="page"]': {
color: "primary.base",
},
}}
>
{crumb.text.toUpperCase()}
</BreadcrumbLink>
Expand Down