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
4 changes: 2 additions & 2 deletions docs/pages/toolpad/core/api/page-container.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"props": {
"breadcrumbs": {
"type": { "name": "arrayOf", "description": "Array<{ path: string, title: string }>" }
"type": { "name": "arrayOf", "description": "Array<{ path?: string, title: string }>" }
},
"slotProps": {
"type": {
"name": "shape",
"description": "{ header: { breadcrumbs?: Array<{ path: string, title: string }>, slotProps?: { toolbar: object }, slots?: { toolbar?: elementType }, title?: string } }"
"description": "{ header: { breadcrumbs?: Array<{ path?: string, title: string }>, slotProps?: { toolbar: object }, slots?: { toolbar?: elementType }, title?: string } }"
}
},
"slots": {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/toolpad/core/api/page-header.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"props": {
"breadcrumbs": {
"type": { "name": "arrayOf", "description": "Array<{ path: string, title: string }>" }
"type": { "name": "arrayOf", "description": "Array<{ path?: string, title: string }>" }
},
"slotProps": { "type": { "name": "shape", "description": "{ toolbar: { children?: node } }" } },
"slots": {
Expand Down
6 changes: 3 additions & 3 deletions packages/toolpad-core/src/PageContainer/PageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface Breadcrumb {
/**
* The path the breadcrumb links to.
*/
path: string;
path?: string;
}
export interface PageContainerSlotProps {
header: PageHeaderProps;
Expand Down Expand Up @@ -89,7 +89,7 @@ PageContainer.propTypes /* remove-proptypes */ = {
*/
breadcrumbs: PropTypes.arrayOf(
PropTypes.shape({
path: PropTypes.string.isRequired,
path: PropTypes.string,
title: PropTypes.string.isRequired,
}),
),
Expand All @@ -104,7 +104,7 @@ PageContainer.propTypes /* remove-proptypes */ = {
header: PropTypes.shape({
breadcrumbs: PropTypes.arrayOf(
PropTypes.shape({
path: PropTypes.string.isRequired,
path: PropTypes.string,
title: PropTypes.string.isRequired,
}),
),
Expand Down
8 changes: 4 additions & 4 deletions packages/toolpad-core/src/PageContainer/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ function PageHeader(props: PageHeaderProps) {
<Breadcrumbs aria-label="breadcrumb">
{resolvedBreadcrumbs
? resolvedBreadcrumbs.map((item, index) => {
return index < resolvedBreadcrumbs.length - 1 ? (
return item.path ? (
<Link
key={item.path}
key={index}
component={ToolpadLink}
underline="hover"
color="inherit"
Expand All @@ -94,7 +94,7 @@ function PageHeader(props: PageHeaderProps) {
{getItemTitle(item)}
</Link>
) : (
<Typography key={item.path} color="text.primary">
<Typography key={index} color="text.primary">
{getItemTitle(item)}
</Typography>
);
Expand All @@ -120,7 +120,7 @@ PageHeader.propTypes /* remove-proptypes */ = {
*/
breadcrumbs: PropTypes.arrayOf(
PropTypes.shape({
path: PropTypes.string.isRequired,
path: PropTypes.string,
title: PropTypes.string.isRequired,
}),
),
Expand Down