opti: style improve of sidebar and topbar #572;

This commit is contained in:
mitsuhatu
2022-07-27 17:40:42 +08:00
parent 9f0064978d
commit 7820fd7b34
11 changed files with 90 additions and 33 deletions
@@ -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 };