Skip to content

Commit 1d4573d

Browse files
feat: making community page image section dynamic
1 parent ee9538b commit 1d4573d

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

pages/community/index.page.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { getLayout } from '~/components/SiteLayout';
33
import { SectionContext } from '~/context';
4-
import imageData from '~/data/community.json';
4+
import imageData from '~/data/community-users.json';
55
import fs from 'fs';
66
import matter from 'gray-matter';
77
import readingTime from 'reading-time';
@@ -100,17 +100,25 @@ export default function communityPages(props: any) {
100100
<div className='grid justify-center items-center gap-y-[10px]'>
101101
<div className='grid justify-center mt-[50px] gap-y-[10px]'>
102102
<div className='grid grid-cols-10 max-sm:grid-cols-7 gap-3'>
103-
{imageData.map((avatar, index) => (
104-
<Image
105-
key={`${avatar.id}-${index}`}
106-
src={avatar.img}
107-
alt={avatar.alt}
108-
width={35}
109-
height={35}
110-
title={avatar.alt}
111-
className='sm:w-[40px] md:w-[45px] lg:w-[50px] sm:h-[40px] md:h-[45px] lg:h-[50px] rounded-full border-black'
112-
/>
113-
))}
103+
{imageData
104+
.filter(
105+
(contributor) =>
106+
contributor.login !== 'the-json-schema-bot[bot]' &&
107+
contributor.login !== 'dependabot[bot]',
108+
)
109+
.sort(() => Math.random() - 0.5)
110+
.slice(0, 60)
111+
.map((avatar, index) => (
112+
<Image
113+
key={`${avatar.id}-${index}`}
114+
src={avatar.avatar_url}
115+
alt={avatar.login}
116+
width={35}
117+
height={35}
118+
title={avatar.login}
119+
className='sm:w-[40px] md:w-[45px] lg:w-[50px] sm:h-[40px] md:h-[45px] lg:h-[50px] rounded-full border-black'
120+
/>
121+
))}
114122
</div>
115123
</div>
116124
</div>

0 commit comments

Comments
 (0)