Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eca00d9

Browse files
committed
blog: cleanup blog layout
1 parent bce22a3 commit eca00d9

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src/components/pages/blog/posts/posts-grid/posts-grid.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,10 @@ import { BlogPost } from '@/types/blog-post';
55
import BlogPostCard from '../../blog-post-card';
66
import { BlogPostTCardThemes } from '../../blog-post-card/blog-post-card';
77

8-
const getPostSize = (index: number): { size: string; theme: BlogPostTCardThemes } => {
9-
if ([3, 4, 15, 16].indexOf(index) > -1) {
10-
return {
11-
size: 'col-span-6',
12-
theme: 'large',
13-
};
14-
}
15-
16-
if (index <= 3 || (index >= 9 && index <= 14)) {
17-
return {
18-
size: 'col-span-4 md:col-span-6',
19-
theme: 'default',
20-
};
21-
}
8+
const getPostSize = (): { size: string; theme: BlogPostTCardThemes } => {
229
return {
23-
size: 'col-span-3 md:col-span-6',
24-
theme: 'small',
10+
size: 'col-span-4 md:col-span-6',
11+
theme: 'default',
2512
};
2613
};
2714

@@ -33,7 +20,7 @@ const PostsGrid = ({ posts }: PostsGridProps) => {
3320
return (
3421
<ul className="gap-x-grid mt-16 grid grid-cols-12 gap-y-14 lg:mt-12 lg:gap-y-12 md:mt-8 md:gap-y-8 xs:mt-6">
3522
{posts.map((post, index) => {
36-
const { size, theme } = getPostSize(index);
23+
const { size, theme } = getPostSize();
3724
return (
3825
<li key={index} className={clsx('xs:col-span-full', size)}>
3926
<BlogPostCard post={post} theme={theme} />

0 commit comments

Comments
 (0)