Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ describe('Breadcrumb', () => {
render(
<Breadcrumb>
<Breadcrumb.Item>Home</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Separator>/</Breadcrumb.Separator>
<Breadcrumb.Item>Products</Breadcrumb.Item>
</Breadcrumb>
);
Expand Down Expand Up @@ -349,13 +349,13 @@ describe('Breadcrumb', () => {
render(
<Breadcrumb>
<Breadcrumb.Item href='/'>Home</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Separator>/</Breadcrumb.Separator>
<Breadcrumb.Item href='/products'>Products</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Separator>/</Breadcrumb.Separator>
<Breadcrumb.Item href='/products/electronics'>
Electronics
</Breadcrumb.Item>
<Breadcrumb.Separator />
<Breadcrumb.Separator>/</Breadcrumb.Separator>
<Breadcrumb.Item current>Laptop</Breadcrumb.Item>
</Breadcrumb>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const BreadcrumbItem = forwardRef<
{leadingIcon && (
<span className={styles['breadcrumb-icon']}>{leadingIcon}</span>
)}
<span>{children}</span>
{children && <span>{children}</span>}
</>
);

Expand Down
64 changes: 41 additions & 23 deletions packages/raystack/components/breadcrumb/breadcrumb-misc.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { DotsHorizontalIcon } from '@radix-ui/react-icons';
import { ChevronRightIcon, DotsHorizontalIcon } from '@radix-ui/react-icons';
import { cx } from 'class-variance-authority';
import { HTMLAttributes, forwardRef } from 'react';
import styles from './breadcrumb.module.css';
Expand All @@ -11,17 +11,26 @@ export interface BreadcrumbEllipsisProps
export const BreadcrumbEllipsis = forwardRef<
HTMLSpanElement,
BreadcrumbEllipsisProps
>(({ className, children = <DotsHorizontalIcon />, ...props }, ref) => {
return (
<span
className={cx(styles['breadcrumb-ellipsis'], className)}
ref={ref}
{...props}
>
{children}
</span>
);
});
>(
(
{
className,
children = <DotsHorizontalIcon width={20} height={20} />,
...props
},
ref
) => {
return (
<span
className={cx(styles['breadcrumb-ellipsis'], className)}
ref={ref}
{...props}
>
{children}
</span>
);
}
);

BreadcrumbEllipsis.displayName = 'BreadcrumbEllipsis';

Expand All @@ -31,16 +40,25 @@ export interface BreadcrumbSeparatorProps
export const BreadcrumbSeparator = forwardRef<
HTMLSpanElement,
BreadcrumbSeparatorProps
>(({ children = '/', className, ...props }, ref) => {
return (
<span
className={cx(styles['breadcrumb-separator'], className)}
ref={ref}
{...props}
>
{children}
</span>
);
});
>(
(
{
children = <ChevronRightIcon width={12} height={12} />,
className,
...props
},
ref
) => {
return (
<span
className={cx(styles['breadcrumb-separator'], className)}
ref={ref}
{...props}
>
{children}
</span>
);
}
);

BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
19 changes: 4 additions & 15 deletions packages/raystack/components/breadcrumb/breadcrumb.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
list-style-type: none;
padding: 0;
margin: 0;
gap: var(--rs-space-2);
}

.breadcrumb-item {
Expand All @@ -35,6 +36,7 @@
color: var(--rs-color-foreground-base-tertiary);
text-decoration: none;
text-wrap: nowrap;
gap: var(--rs-space-2);
}

.breadcrumb-link:hover {
Expand All @@ -50,24 +52,11 @@
.breadcrumb-icon {
display: flex;
align-items: center;
margin-right: var(--rs-space-2);
}

.breadcrumb-separator {
color: var(--rs-color-foreground-base-tertiary);
margin: 0 var(--rs-space-3);
}

.breadcrumb-separator,
.breadcrumb-ellipsis {
display: flex;
align-items: center;
color: var(--rs-color-foreground-base-secondary);
}

.breadcrumb-ellipsis svg {
width: var(--rs-space-4);
height: var(--rs-space-4);
color: var(--rs-color-foreground-base-secondary);
color: var(--rs-color-foreground-base-tertiary);
}

.breadcrumb-dropdown-trigger {
Expand Down