File tree Expand file tree Collapse file tree 3 files changed +18
-10
lines changed
components/Common/Partners Expand file tree Collapse file tree 3 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,14 @@ const PartnersLogoList: FC<PartnersLogoListProps> = ({
20
20
} ) => {
21
21
const initialRenderer = useRef ( true ) ;
22
22
23
- const [ seedList , setSeedList ] = useState < Array < Partners > > (
24
- LOGO_PARTNERS . slice ( 0 , maxLength )
25
- ) ;
23
+ const [ seedList , setSeedList ] = useState < Array < Partners > > ( ( ) => {
24
+ if ( maxLength === null ) {
25
+ return LOGO_PARTNERS . filter (
26
+ partner => ! categories || partner . categories . includes ( categories )
27
+ ) ;
28
+ }
29
+ return LOGO_PARTNERS . slice ( 0 , maxLength ) ;
30
+ } ) ;
26
31
27
32
useEffect ( ( ) => {
28
33
// We intentionally render the initial default "mock" list of sponsors
Original file line number Diff line number Diff line change 1
1
import type { PartnerCategory , Partners } from '#site/types/partners.js' ;
2
2
3
3
// TODO: Implement no random list
4
- // TODO: Implement no limit items
4
+ // TODO: Implement no importance of partner
5
5
function randomPartnerList (
6
6
partners : Array < Partners > ,
7
7
pick = 4 ,
@@ -28,12 +28,15 @@ function randomPartnerList(
28
28
const rng = mulberry32 ( seed ) ;
29
29
30
30
// Create a copy of the array to avoid modifying the original
31
- const shuffled = partners
31
+ let shuffled = [ ... partners ]
32
32
. filter ( partner => ! category || partner . categories . includes ( category ) )
33
- . slice ( )
34
33
. sort ( ( ) => rng ( ) - 0.5 ) ;
35
34
36
- return shuffled . slice ( 0 , pick ) ;
35
+ if ( pick !== null ) {
36
+ shuffled = shuffled . slice ( 0 , pick ) ;
37
+ }
38
+
39
+ return shuffled ;
37
40
}
38
41
39
42
// This function returns a random list of partners based on a fixed time seed
Original file line number Diff line number Diff line change @@ -11,19 +11,19 @@ Importance of partners and their role and explains our partner categories (Ecosy
11
11
12
12
Projects with their logo, name, tier, the description and a CTA button
13
13
14
- <PartnersLogoList categories = " infrastructure" />
14
+ <PartnersLogoList categories = " infrastructure" maxLength = { null } />
15
15
16
16
## Security
17
17
18
18
Projects with their logo, name, tier, the description and a CTA button
19
19
20
- <PartnersLogoList categories = " security" />
20
+ <PartnersLogoList categories = " security" maxLength = { null } />
21
21
22
22
## Ecosystem Sustainability Program (ESP)
23
23
24
24
Projects with their logo, name, tier, the description and a CTA button
25
25
26
- <PartnersLogoList categories = " esp" />
26
+ <PartnersLogoList categories = " esp" maxLength = { null } />
27
27
28
28
## Backers (Open Collective and GitHub Sponsors)
29
29
You can’t perform that action at this time.
0 commit comments