teqo-backup/src/components/campaign/CreateCampaignClientDynamic.tsx
2026-07-19 18:36:33 -03:00

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" />
),
})