Skip to content

Commit 2f7fee0

Browse files
committed
Make all contributor params optional
1 parent a526da4 commit 2f7fee0

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

components/mdx/ContributorFooter.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { Box, Text, VStack } from '@chakra-ui/react'
22
import { Contributor } from '@components/mdx/Contributor'
33

44
interface ContributorFooterProps {
5-
authors: string[]
6-
reviewers: string[]
7-
contributors: string[]
5+
authors?: string[]
6+
reviewers?: string[]
7+
contributors?: string[]
88
}
99

1010
export function ContributorFooter({
@@ -20,7 +20,7 @@ export function ContributorFooter({
2020
borderTopWidth="thin"
2121
borderColor="gray"
2222
>
23-
{authors && authors.length > 0 && (
23+
{authors && Array.isArray(authors) && authors.length > 0 && (
2424
<Box>
2525
<Text fontSize={26} marginTop={8} marginBottom={4}>
2626
{authors.length > 1 ? 'Authors' : 'Author'}
@@ -33,7 +33,7 @@ export function ContributorFooter({
3333
</Box>
3434
)}
3535

36-
{reviewers && reviewers.length > 0 && (
36+
{reviewers && Array.isArray(reviewers) && reviewers.length > 0 && (
3737
<Box>
3838
<Text fontSize={20} marginTop={8} marginBottom={4}>
3939
{reviewers.length > 1 ? 'Reviewers' : 'Reviewer'}
@@ -46,20 +46,22 @@ export function ContributorFooter({
4646
</Box>
4747
)}
4848

49-
{contributors && contributors.length > 0 && (
50-
<Box>
51-
<Text fontSize={20} marginTop={8} marginBottom={4}>
52-
{contributors.length > 1
53-
? 'Additional Contributors'
54-
: 'Additional Contributor'}
55-
</Text>
56-
<VStack spacing={4} alignItems="left">
57-
{contributors.map((contrib) => {
58-
return <Contributor handle={contrib} avatarSize="lg" />
59-
})}
60-
</VStack>
61-
</Box>
62-
)}
49+
{contributors &&
50+
Array.isArray(contributors) &&
51+
contributors.length > 0 && (
52+
<Box>
53+
<Text fontSize={20} marginTop={8} marginBottom={4}>
54+
{contributors.length > 1
55+
? 'Additional Contributors'
56+
: 'Additional Contributor'}
57+
</Text>
58+
<VStack spacing={4} alignItems="left">
59+
{contributors.map((contrib) => {
60+
return <Contributor handle={contrib} avatarSize="lg" />
61+
})}
62+
</VStack>
63+
</Box>
64+
)}
6365
</Box>
6466
)
6567
}

0 commit comments

Comments
 (0)