Skip to content

Commit 82c086f

Browse files
Feat: Dynamic contributors' avatars in the Community page (#1364)
* feat: making community page image section dynamic * fix: removed contributor images and community.json file
1 parent 42f23bd commit 82c086f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+20
-314
lines changed

data/community.json

Lines changed: 0 additions & 302 deletions
This file was deleted.

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>
-49.9 KB
Binary file not shown.
-25.8 KB
Binary file not shown.
-35.8 KB
Binary file not shown.
-21.3 KB
Binary file not shown.
-33.8 KB
Binary file not shown.
-15.4 KB
Binary file not shown.
-29.1 KB
Binary file not shown.
-13.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)