Refactor function components across multiple files
Function components have been refactored across the codebase. Single export-const arrow function components have been adapted into traditional function declarations. This change provides better stack trace in case of errors and better function and argument names on runtime debugging.
This commit is contained in:
@@ -9,12 +9,7 @@ type Props = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export const CoverImage: React.FC<Props> = ({
|
||||
title,
|
||||
src,
|
||||
preloadImage,
|
||||
className,
|
||||
}) => {
|
||||
export function CoverImage({ title, src, preloadImage, className }: Props) {
|
||||
return (
|
||||
<Image
|
||||
className={cn(
|
||||
@@ -30,4 +25,4 @@ export const CoverImage: React.FC<Props> = ({
|
||||
fill
|
||||
/>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,12 +2,10 @@ import { Cms } from '@kit/cms';
|
||||
import { If } from '@kit/ui/if';
|
||||
import { cn } from '@kit/ui/utils';
|
||||
|
||||
import { CoverImage } from '~/(marketing)/blog/_components/cover-image';
|
||||
import { DateFormatter } from '~/(marketing)/blog/_components/date-formatter';
|
||||
import { CoverImage } from './cover-image';
|
||||
import { DateFormatter } from './date-formatter';
|
||||
|
||||
export const PostHeader: React.FC<{
|
||||
post: Cms.ContentItem;
|
||||
}> = ({ post }) => {
|
||||
export function PostHeader({ post }: { post: Cms.ContentItem }) {
|
||||
const { title, publishedAt, description, image } = post;
|
||||
|
||||
return (
|
||||
@@ -45,4 +43,4 @@ export const PostHeader: React.FC<{
|
||||
</If>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,10 +4,13 @@ import { ContentRenderer } from '@kit/cms';
|
||||
import styles from './html-renderer.module.css';
|
||||
import { PostHeader } from './post-header';
|
||||
|
||||
export const Post: React.FC<{
|
||||
export function Post({
|
||||
post,
|
||||
content,
|
||||
}: {
|
||||
post: Cms.ContentItem;
|
||||
content: unknown;
|
||||
}> = ({ post, content }) => {
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
<PostHeader post={post} />
|
||||
@@ -19,4 +22,4 @@ export const Post: React.FC<{
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user