Skip to content

Commit c7afe92

Browse files
committed
feat: update Contributors to accept option list override
1 parent 17c5475 commit c7afe92

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/components/Contributors/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@ export interface Contributor {
2020

2121
const allContributors = JSON.parse(data)
2222

23-
const Contributors = () => {
23+
interface ContributorsProps {
24+
contributors?: Contributor[]
25+
}
26+
27+
const Contributors = ({ contributors }: ContributorsProps) => {
2428
const [contributorsList, setContributorsList] = useState<Contributor[]>([])
2529

2630
useEffect(() => {
27-
setContributorsList(shuffle(allContributors.contributors))
28-
}, [])
31+
if (contributors) {
32+
setContributorsList(contributors)
33+
} else {
34+
setContributorsList(shuffle(allContributors.contributors))
35+
}
36+
}, [contributors])
2937

3038
return (
3139
<>

0 commit comments

Comments
 (0)