From 1729fa8561e5a2d6e9a9ca09f1184104b64c79a5 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 13 Aug 2022 22:28:11 -0500 Subject: [PATCH] Add joinJSX utility function --- src/util/vue.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/util/vue.tsx b/src/util/vue.tsx index 3220770..8b8bf09 100644 --- a/src/util/vue.tsx +++ b/src/util/vue.tsx @@ -12,7 +12,6 @@ import { onUnmounted, ref, shallowRef, - toRef, unref, watchEffect } from "vue"; @@ -38,10 +37,10 @@ export function coerceComponent( return component; } -export type VueFeature = { +export interface VueFeature { [ComponentKey]: GenericComponent; [GatherProps]: () => Record; -}; +} export function render(object: VueFeature | CoercableComponent): JSX.Element | DefineComponent { if (isCoercableComponent(object)) { @@ -86,6 +85,16 @@ export function renderColJSX(...objects: (VueFeature | CoercableComponent)[]): J return {objects.map(renderJSX)}; } +export function joinJSX(objects: JSX.Element[], joiner: JSX.Element): JSX.Element { + return objects.reduce((acc, curr) => ( + <> + {acc} + {joiner} + {curr} + + )); +} + export function isCoercableComponent(component: unknown): component is CoercableComponent { if (typeof component === "string") { return true;