You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
639 B
32 lines
639 B
3 years ago
|
interface IndentProps {
|
||
|
prefixCls: string;
|
||
|
level: number;
|
||
|
isStart: boolean[];
|
||
|
isEnd: boolean[];
|
||
|
}
|
||
|
|
||
|
const Indent = ({ prefixCls, level, isStart, isEnd }: IndentProps) => {
|
||
|
const baseClassName = `${prefixCls}-indent-unit`;
|
||
|
const list = [];
|
||
|
for (let i = 0; i < level; i += 1) {
|
||
|
list.push(
|
||
|
<span
|
||
|
key={i}
|
||
|
class={{
|
||
|
[baseClassName]: true,
|
||
|
[`${baseClassName}-start`]: isStart[i],
|
||
|
[`${baseClassName}-end`]: isEnd[i],
|
||
|
}}
|
||
|
/>,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<span aria-hidden="true" class={`${prefixCls}-indent`}>
|
||
|
{list}
|
||
|
</span>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default Indent;
|