Skip to content

Commit 906a1f5

Browse files
authored
feat: Add Documentation for the Community Component (#271)
1 parent e18c84c commit 906a1f5

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

src/pages/community.js

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@ const ResponsiveGrid = ({ children }) => {
3535
</Grid>
3636
)
3737
}
38+
/**
39+
* A Card component that displays a community member's photo, name, role, and profile URL.
40+
* It also handles whether the member is a current contributor or not.
41+
*
42+
* @param {object} props
43+
* @param {string} props.img - The image URL of the member; shown only if isCurrentContributor is true
44+
* @param {string} props.name - The member's name used in alt text for accessibility
45+
* @param {string} props.role - The role of the member (e.g., Developer); used as fallback if name is missing
46+
* @param {string} props.url - The URL to open on click (e.g., LinkedIn or GitHub profile)
47+
* @param {boolean} [props.isCurrentContributor=false] - Whether the member is a current contributor
48+
*
49+
* @returns {JSX.Element}
50+
*
51+
*/
3852

3953
const CommunityMemberCard = ({
4054
img,
@@ -78,11 +92,11 @@ const CommunityMemberCard = ({
7892
width: "100%",
7993
height: "100%",
8094
objectFit: "cover",
81-
// borderRadius: "50%",
8295
}}
8396
/>
8497
</Box>
8598
)}
99+
86100
{(name?.trim() || role?.trim()) && (
87101
<PlainExternalLink href={url} target="_blank">
88102
<Box
@@ -115,8 +129,31 @@ const CommunityMemberCard = ({
115129
</Box>
116130
)
117131

132+
133+
/**
134+
* Renders the Community page with lists of current and past contributors.
135+
*
136+
* Filters contributors from the received data based on their `isCurrentContributor` flag.
137+
* - Current contributors are displayed with name, role, image, and URL.
138+
* - Past contributors are displayed with name, role, and URL (without image).
139+
*
140+
* Each contributor is rendered inside a `CommunityMemberCard` within a responsive grid layout.
141+
*
142+
* @param {object} props
143+
* @param {object} props.data - The GraphQL data containing contributor details
144+
* @param {Array} props.data.allMdx.nodes - Array of MDX nodes, each representing a contributor
145+
* @param {object} props.data.allMdx.nodes[].frontmatter - Frontmatter fields of each contributor
146+
* @param {string} props.data.allMdx.nodes[].frontmatter.name - Contributor's name
147+
* @param {string} props.data.allMdx.nodes[].frontmatter.role - Contributor's role
148+
* @param {string} props.data.allMdx.nodes[].frontmatter.url - External URL for the contributor
149+
* @param {string} props.data.allMdx.nodes[].frontmatter.img - Contributor's image URL
150+
* @param {boolean} props.data.allMdx.nodes[].frontmatter.isCurrentContributor - True if contributor is currently active
151+
*
152+
* Displays a note acknowledging contributions from other volunteers.
153+
* @returns {JSX.Element} The rendered Community page
154+
*/
155+
118156
const community = ({ data }) => {
119-
// const contributors = data.allMdx.nodes;
120157
const currentContributors = data.allMdx.nodes.filter(
121158
(contributor) => contributor.frontmatter.isCurrentContributor
122159
)
@@ -128,7 +165,9 @@ const community = ({ data }) => {
128165
<DefaultLayout>
129166
<NarrowContentWrapper>
130167
<NarrowSection>
168+
131169
<Heading level={2}> Community </Heading>
170+
132171
<Heading level={3}>Current Contributors and Staff</Heading>
133172
<ResponsiveGrid>
134173
{currentContributors.map((contributor, key) => (

0 commit comments

Comments
 (0)