From 90d9ba522613f027b5bc4fdc59f857152b7a0a98 Mon Sep 17 00:00:00 2001 From: mrdrogdrog Date: Sun, 17 May 2020 23:21:10 +0200 Subject: [PATCH] Add element-separator (#42) Add element-separator Signed-off-by: Tilman Vatteroth --- .../element-separator/element-separator.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/components/element-separator/element-separator.tsx diff --git a/src/components/element-separator/element-separator.tsx b/src/components/element-separator/element-separator.tsx new file mode 100644 index 000000000..f9cb33021 --- /dev/null +++ b/src/components/element-separator/element-separator.tsx @@ -0,0 +1,22 @@ +import React, {Fragment} from "react"; + +export interface ElementSeparatorProps { + separator: React.ReactElement +} + +export const ElementSeparator: React.FC = ({children, separator}) => { + return ( + + { + React.Children.map(children, (child, index) => { + return + { + (index > 0) ? separator : null + } + {child} + + }) + } + + ) +} \ No newline at end of file