Files
myeasycms-v2/packages/cms/core/src/content-renderer.tsx
giancarlo c330158b3f Remove unused import in content-renderer.tsx
The import statement for KeystaticContentRenderer from '@kit/keystatic' in content-renderer.tsx file was removed as it was not being used anywhere in the file. This helps to make the code cleaner and more efficient.
2024-05-07 20:15:02 +07:00

38 lines
811 B
TypeScript

import type { CmsType } from './cms.type';
const CMS_CLIENT = process.env.CMS_CLIENT as CmsType;
interface ContentRendererProps {
content: unknown;
type?: CmsType;
}
export async function ContentRenderer({
content,
type = CMS_CLIENT,
}: ContentRendererProps) {
switch (type) {
case 'keystatic': {
const { KeystaticContentRenderer } = await import(
'../../keystatic/src/content-renderer'
);
return <KeystaticContentRenderer content={content} />;
}
case 'wordpress': {
const { WordpressContentRenderer } = await import(
'../../wordpress/src/content-renderer'
);
return <WordpressContentRenderer content={content} />;
}
default: {
console.error(`Unknown CMS client: ${type as string}`);
return null;
}
}
}