mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-24 18:56:32 -05:00
Add element-separator (#42)
Add element-separator Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
0e18d0f8da
commit
90d9ba5226
1 changed files with 22 additions and 0 deletions
22
src/components/element-separator/element-separator.tsx
Normal file
22
src/components/element-separator/element-separator.tsx
Normal file
|
@ -0,0 +1,22 @@
|
|||
import React, {Fragment} from "react";
|
||||
|
||||
export interface ElementSeparatorProps {
|
||||
separator: React.ReactElement
|
||||
}
|
||||
|
||||
export const ElementSeparator: React.FC<ElementSeparatorProps> = ({children, separator}) => {
|
||||
return (
|
||||
<Fragment>
|
||||
{
|
||||
React.Children.map(children, (child, index) => {
|
||||
return <Fragment>
|
||||
{
|
||||
(index > 0) ? separator : null
|
||||
}
|
||||
{child}
|
||||
</Fragment>
|
||||
})
|
||||
}
|
||||
</Fragment>
|
||||
)
|
||||
}
|
Loading…
Reference in a new issue