Skip to content

Commit

Permalink
fix: the issue of the breadcrumb link and make it depend on the as pr…
Browse files Browse the repository at this point in the history
…ops #95
  • Loading branch information
HamzaAmar committed Oct 30, 2024
1 parent 183a3db commit d2f96fe
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 99 deletions.
4 changes: 4 additions & 0 deletions apps/docs/content/components/breadcrumb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ import { Breadcrumb } from '@pillar-ui/core'
<Prop defaultValue="4" type="'1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'" />

<Playground direction="column" name="breadcrumbSize" root="breadcrumb" />

### As

<Playground direction="column" name="breadcrumbAs" root="breadcrumb" />
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,33 @@ const breadcrumbsItems = [
]

export const BreadcrumbAs = () => {
const items = breadcrumbsItems.map(({ name, link, current }) => (
<BreadcrumbItem current={current} key={name} link={link}>
const aItems = breadcrumbsItems.map(({ name, link, current }) => (
<BreadcrumbItem current={current} key={name} href={link}>
{name}
</BreadcrumbItem>
))
const linkItems = breadcrumbsItems.map(({ name, link, current }) => (
<BreadcrumbItem as={Link} current={current} key={name} href={link}>
{name}
</BreadcrumbItem>
))
const buttonItems = breadcrumbsItems.map(({ name, link, current }) => (
<BreadcrumbItem
as="button"
current={current}
key={name}
onClick={() => {
alert('Hello')
}}
>
{name}
</BreadcrumbItem>
))
return (
<>
<Breadcrumb color="d">{items}</Breadcrumb>
<Breadcrumb color="w">{items}</Breadcrumb>
<Breadcrumb color="su">{items}</Breadcrumb>
<Breadcrumb color="se">{items}</Breadcrumb>
<Breadcrumb color="p">{items}</Breadcrumb>
<Breadcrumb color="b">{items}</Breadcrumb>
<Breadcrumb color="i">{items}</Breadcrumb>
<Breadcrumb>{aItems}</Breadcrumb>
<Breadcrumb>{linkItems}</Breadcrumb>
<Breadcrumb>{buttonItems}</Breadcrumb>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const breadcrumbsItems = [

export const BreadcrumbColor = () => {
const items = breadcrumbsItems.map(({ name, link, current }) => (
<BreadcrumbItem current={current} key={name} link={link}>
<BreadcrumbItem current={current} key={name} href={link}>
{name}
</BreadcrumbItem>
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const BreadcrumbIcon = () => {
<>
<Breadcrumb>
{breadcrumbsItems.map(({ name, link, icon, current }) => (
<BreadcrumbItem key={name} link={link} current={current}>
<BreadcrumbItem key={name} href={link} current={current}>
{name}
{icon}
</BreadcrumbItem>
Expand All @@ -22,7 +22,7 @@ export const BreadcrumbIcon = () => {

<Breadcrumb>
{breadcrumbsItems.map(({ name, link, icon, current }) => (
<BreadcrumbItem key={name} link={link} current={current}>
<BreadcrumbItem key={name} href={link} current={current}>
{icon}
{name}
</BreadcrumbItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const breadcrumbsItems = [

export const BreadcrumbSeparator = () => {
const items = breadcrumbsItems.map(({ name, link, current }) => (
<BreadcrumbItem current={current} key={name} link={link}>
<BreadcrumbItem current={current} key={name} href={link}>
{name}
</BreadcrumbItem>
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const breadcrumbsItems = [

export const BreadcrumbSize = () => {
const items = breadcrumbsItems.map(({ name, link, current }) => (
<BreadcrumbItem current={current} key={name} link={link}>
<BreadcrumbItem current={current} key={name} href={link}>
{name}
</BreadcrumbItem>
))
Expand Down
Loading

0 comments on commit d2f96fe

Please sign in to comment.