Files
react/components/tree/tree-indents.tsx
unix 4e7b4cc57d refactor: export all hooks functions directly from main module
refactor: rename the modules to make sure tree-shaking works
2020-05-16 23:04:57 +08:00

27 lines
568 B
TypeScript

import React from 'react'
interface Props {
count: number
}
const TreeIndents: React.FC<Props> = ({ count }) => {
if (count === 0) return null
return (
/* eslint-disable react/jsx-no-useless-fragment */
<>
{[...new Array(count)].map((_, index) => (
<span className="indent" key={`indent-${index}`}>
<style jsx>{`
span.indent {
left: calc(-1.875rem * ${index + 1} + 0.75rem);
}
`}</style>
</span>
))}
</>
/* eslint-enable */
)
}
export default TreeIndents