mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 10:36:22 +08:00
opti: style improve of sidebar and topbar #572;
This commit is contained in:
@@ -34,6 +34,7 @@ const StyledContainerForHeaderRoot = styled('div')(({ theme }) => {
|
||||
return {
|
||||
width: '100%',
|
||||
zIndex: theme.affine.zIndex.header,
|
||||
backgroundColor: '#fff',
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ export const CurrentPageTitle = () => {
|
||||
const { workspace_id } = params;
|
||||
const [pageId, setPageId] = useState<string>('');
|
||||
const [pageTitle, setPageTitle] = useState<string | undefined>();
|
||||
/* card.7 */
|
||||
// const { items } = usePageTree();
|
||||
|
||||
useEffect(() => {
|
||||
if (params['*']) {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { TreeItem, TreeItems } from './../workspace-sidebar/page-tree';
|
||||
|
||||
const pickPath = (treeItems: TreeItem | TreeItems, targetId: string) => {
|
||||
const pick = (tree: TreeItem, result: TreeItem[] = []) => {
|
||||
if (tree.id === targetId) {
|
||||
result.push(tree);
|
||||
return result;
|
||||
}
|
||||
|
||||
for (const child of tree?.children || []) {
|
||||
if (pick(child, result).length) {
|
||||
result.unshift(tree);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
return (Array.isArray(treeItems) ? treeItems : [treeItems]).map(treeItem =>
|
||||
pick(treeItem)
|
||||
);
|
||||
};
|
||||
|
||||
export { pickPath };
|
||||
Reference in New Issue
Block a user