mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 08:53:11 +00:00
18 lines
553 B
TypeScript
18 lines
553 B
TypeScript
'use client'
|
|
|
|
import dynamic from 'next/dynamic'
|
|
import type { ComponentType } from 'react'
|
|
|
|
import { Skeleton } from '@/components/ui/skeleton'
|
|
|
|
export const createCampaignClientDynamic = <P extends object>(
|
|
importModule: () => Promise<Record<string, ComponentType<P>>>,
|
|
exportName: string,
|
|
skeletonHeightClassName: string,
|
|
) =>
|
|
dynamic(() => importModule().then((module) => module[exportName]), {
|
|
ssr: false,
|
|
loading: () => (
|
|
<Skeleton className={`${skeletonHeightClassName} w-full rounded-lg`} aria-hidden="true" />
|
|
),
|
|
})
|