This commit is contained in:
2025-10-31 18:19:52 +01:00
parent c146084f75
commit 2d8a4432cc
5 changed files with 93 additions and 42 deletions
+55
View File
@@ -0,0 +1,55 @@
import React from 'react';
import { ArrowUpIcon } from '../ui/icons';
export const createWorkspaceSurfaceConfig = ({
title,
subtitle = null,
sidebarToggle = null,
parentBreadcrumb = null,
onNavigateParent = null,
actions = null,
breadcrumbs = null,
content = null,
detail = null,
variant = 'documents',
key = 'documents',
}) => {
const showParent = parentBreadcrumb && typeof onNavigateParent === 'function';
const parentControl = showParent ? (
<button
type="button"
className="icon-button"
onClick={onNavigateParent}
aria-label="Go to parent folder"
title="Go to parent folder"
>
<ArrowUpIcon />
</button>
) : null;
const leading = sidebarToggle || parentControl
? (
<>
{sidebarToggle}
{parentControl}
</>
)
: null;
return {
key,
variant,
header: {
title,
subtitle,
leading,
actions,
breadcrumbs,
},
content,
detail,
};
};
export default createWorkspaceSurfaceConfig;