zent
Version:
一套前端设计语言和基于React的实现
22 lines (17 loc) • 402 B
text/typescript
import { CSSProperties } from 'react';
export function getKeyFromChildrenIndex(child, index, subPrefix = 'item') {
return child.key || `${subPrefix}_${index}`;
}
export function getExtraStyle({
isInline,
depth,
inlineIndent,
}): CSSProperties {
let styleObject = {};
if (isInline) {
styleObject = {
paddingLeft: `${depth * inlineIndent}px`,
};
}
return styleObject;
}