mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat: modify sidebar style (#1703)
This commit is contained in:
@@ -46,7 +46,7 @@ export const TreeNode = <N,>({
|
||||
allDrop = true,
|
||||
...otherProps
|
||||
}: TreeNodeProps<N>) => {
|
||||
const { onAdd, onDelete, onDrop } = otherProps;
|
||||
const { onAdd, onDelete, onDrop, indent } = otherProps;
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
|
||||
const [{ isDragging }, drag] = useDrag(() => ({
|
||||
@@ -109,7 +109,7 @@ export const TreeNode = <N,>({
|
||||
)}
|
||||
</StyledTreeNodeItem>
|
||||
|
||||
<StyledCollapse in={!collapsed}>
|
||||
<StyledCollapse in={!collapsed} indent={indent}>
|
||||
{node.children &&
|
||||
node.children.map((childNode, index) => (
|
||||
<TreeNode
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import MuiCollapse from '@mui/material/Collapse';
|
||||
import type { CSSProperties } from 'react';
|
||||
|
||||
import { styled } from '../../styles';
|
||||
|
||||
export const StyledCollapse = styled(MuiCollapse)(() => {
|
||||
export const StyledCollapse = styled(MuiCollapse)<{
|
||||
indent?: CSSProperties['paddingLeft'];
|
||||
}>(({ indent = 12 }) => {
|
||||
return {
|
||||
paddingLeft: '12px',
|
||||
paddingLeft: indent,
|
||||
};
|
||||
});
|
||||
export const StyledTreeNodeItem = styled('div')<{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import type { CSSProperties, ReactNode } from 'react';
|
||||
|
||||
export type Node<N> = {
|
||||
id: string;
|
||||
@@ -16,6 +16,7 @@ export type Node<N> = {
|
||||
} & N;
|
||||
|
||||
type CommonProps<N> = {
|
||||
indent?: CSSProperties['paddingLeft'];
|
||||
onAdd?: (node: Node<N>) => void;
|
||||
onDelete?: (node: Node<N>) => void;
|
||||
onDrop?: (
|
||||
|
||||
Reference in New Issue
Block a user