Skip to content

Commit 77b64f3

Browse files
doc: order testing library users alphabetically, handle pinned users (testing-library#456)
* doc: order testing library users alphabetically * Add more users using testing library * Docs: rendomize users list * Docs: set to false the pinned property * handle pinned users * update pins Co-authored-by: Oriol Puig <[email protected]> Co-authored-by: Alex Krolick <[email protected]>
1 parent 17e7335 commit 77b64f3

File tree

8 files changed

+202
-72
lines changed

8 files changed

+202
-72
lines changed

website/pages/en/index.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,21 +260,41 @@ class Index extends React.Component {
260260
if ((siteConfig.users || []).length === 0) {
261261
return null
262262
}
263+
const NUMBER_OF_UNPINNED_USERS_TO_SHOWCASE = 3
263264

264-
const showcase = siteConfig.users
265-
.filter(user => user.pinned)
266-
.map(user => (
267-
<a href={user.infoLink} key={user.infoLink}>
268-
<img src={user.image} alt={user.caption} title={user.caption} />
269-
</a>
270-
))
265+
const randomizedList = (arr, n) => {
266+
var result = new Array(n),
267+
len = arr.length,
268+
taken = new Array(len)
269+
if (n > len) return arr
270+
while (n--) {
271+
var x = Math.floor(Math.random() * len)
272+
result[n] = arr[x in taken ? taken[x] : x]
273+
taken[x] = --len in taken ? taken[len] : len
274+
}
275+
return result
276+
}
277+
278+
const userShowcase = [
279+
...siteConfig.users.filter(u => u.pinned),
280+
...randomizedList(
281+
siteConfig.users.filter(u => !u.pinned),
282+
NUMBER_OF_UNPINNED_USERS_TO_SHOWCASE
283+
),
284+
]
285+
286+
const userLogos = userShowcase.map(user => (
287+
<a href={user.infoLink} key={user.infoLink}>
288+
<img src={user.image} alt={user.caption} title={user.caption} />
289+
</a>
290+
))
271291

272292
const pageUrl = page => baseUrl + (language ? `${language}/` : '') + page
273293

274294
return (
275295
<div className="productShowcaseSection paddingBottom">
276296
<h2>Who is Using This?</h2>
277-
<div className="logos">{showcase}</div>
297+
<div className="logos">{userLogos}</div>
278298
<div className="more-users">
279299
<a className="button" href={pageUrl('users.html')}>
280300
More {siteConfig.title} Users

website/siteConfig.js

Lines changed: 100 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,16 @@
1111
// List of projects/orgs using your project for the users page.
1212
const users = [
1313
{
14-
caption: 'PayPal',
15-
image: '/img/users/paypal.svg',
16-
infoLink: 'https://www.paypal.com',
17-
pinned: true,
18-
},
19-
{
20-
caption: 'Walmart Labs',
14+
caption: 'Autodesk',
15+
image: '/img/users/autodesk.svg',
16+
infoLink: 'https://www.autodesk.com',
2117
pinned: true,
22-
image: '/img/users/walmart.png',
23-
infoLink: 'https://www.walmartlabs.com/',
2418
},
2519
{
26-
caption: 'Tiller',
27-
image: '/img/users/tiller.svg',
28-
infoLink: 'https://www.tillersystems.com',
29-
pinned: true,
20+
caption: 'Coches.net',
21+
image: '/img/users/coches.svg',
22+
infoLink: 'https://www.coches.net/',
23+
pinned: false,
3024
},
3125
{
3226
caption: 'Codecademy',
@@ -35,100 +29,142 @@ const users = [
3529
pinned: true,
3630
},
3731
{
38-
caption: 'Autodesk',
39-
image: '/img/users/autodesk.svg',
40-
infoLink: 'https://www.autodesk.com',
32+
caption: 'Expedia Group',
33+
image: '/img/users/expediagroup.svg',
34+
infoLink: 'https://www.expediagroup.com',
4135
pinned: true,
4236
},
4337
{
44-
caption: 'Sweepbright',
45-
image: '/img/users/sweepbright.svg',
46-
infoLink: 'https://sweepbright.com',
38+
caption: 'Facebook Open Source',
39+
image: '/img/users/facebook-open-source.png',
40+
infoLink: 'https://opensource.facebook.com',
4741
pinned: true,
4842
},
4943
{
50-
caption: 'TravelPerk',
51-
image: '/img/users/travelperk.svg',
52-
infoLink: 'https://www.travelperk.com',
53-
pinned: true,
44+
caption: 'Fotocasa',
45+
image: '/img/users/fotocasa.svg',
46+
infoLink: 'https://www.fotocasa.es/',
47+
pinned: false,
5448
},
5549
{
56-
caption: 'Velo Payments',
57-
image: '/img/users/velopayments.svg',
58-
infoLink: 'https://www.velopayments.com',
59-
pinned: true,
50+
caption: 'Global CTO Forum',
51+
image: '/img/users/global-cto-forum.svg',
52+
infoLink: 'https://globalctoforum.org',
53+
pinned: false,
6054
},
6155
{
62-
caption: 'Parsley Health',
63-
image: '/img/users/parsleyhealth.svg',
64-
infoLink: 'https://www.parsleyhealth.com',
56+
caption: 'Gusto',
57+
image: '/img/users/gusto.svg',
58+
infoLink: 'https://gusto.com/',
6559
pinned: true,
6660
},
6761
{
68-
caption: 'Facebook Open Source',
69-
image: '/img/users/facebook-open-source.png',
70-
infoLink: 'https://opensource.facebook.com',
71-
pinned: true,
62+
caption: 'Habitaclia',
63+
image: '/img/users/habitaclia.svg',
64+
infoLink: 'https://www.habitaclia.com/',
65+
pinned: false,
7266
},
7367
{
74-
caption: 'Expedia Group',
75-
image: '/img/users/expediagroup.svg',
76-
infoLink: 'https://www.expediagroup.com',
77-
pinned: true,
68+
caption: 'iFood',
69+
image: '/img/users/ifood.png',
70+
infoLink: 'https://www.ifood.com.br',
71+
pinned: false,
7872
},
7973
{
80-
caption: 'Wix.com',
81-
image: '/img/users/wix.svg',
82-
infoLink: 'https://www.wix.com',
83-
pinned: true,
84-
},
85-
{
86-
caption: 'Testsigma',
87-
image: '/img/users/testsigma.svg',
88-
infoLink: 'https://www.testsigma.com',
89-
pinned: true,
74+
caption: 'Infojobs',
75+
image: '/img/users/infojobs.svg',
76+
infoLink: 'https://www.infojobs.net/',
77+
pinned: false,
9078
},
9179
{
9280
caption: 'intelliHR',
9381
image: '/img/users/intellihr.svg',
9482
infoLink: 'https://intellihr.com.au',
83+
pinned: false,
84+
},
85+
{
86+
caption: 'Milanuncios',
87+
image: '/img/users/milanuncios.svg',
88+
infoLink: 'https://www.milanuncios.com',
89+
pinned: false,
90+
},
91+
{
92+
caption: 'Parsley Health',
93+
image: '/img/users/parsleyhealth.svg',
94+
infoLink: 'https://www.parsleyhealth.com',
95+
pinned: false,
96+
},
97+
{
98+
caption: 'PayPal',
99+
image: '/img/users/paypal.svg',
100+
infoLink: 'https://www.paypal.com',
95101
pinned: true,
96102
},
97103
{
98104
caption: 'Quizlet',
99105
image: '/img/users/quizlet.svg',
100106
infoLink: 'https://quizlet.com',
101-
pinned: true,
107+
pinned: false,
102108
},
103109
{
104110
caption: 'Radity',
105111
image: '/img/users/radity.svg',
106112
infoLink: 'https://radity.com',
107-
pinned: true,
113+
pinned: false,
108114
},
109115
{
110-
caption: 'Global CTO Forum',
111-
image: '/img/users/global-cto-forum.svg',
112-
infoLink: 'https://globalctoforum.org',
113-
pinned: true,
116+
caption: 'SUI Components',
117+
image: '/img/users/sui.svg',
118+
infoLink: 'https://sui-components.now.sh/',
119+
pinned: false,
114120
},
115121
{
116-
caption: 'Gusto',
117-
image: '/img/users/gusto.svg',
118-
infoLink: 'https://gusto.com/',
122+
caption: 'Sweepbright',
123+
image: '/img/users/sweepbright.svg',
124+
infoLink: 'https://sweepbright.com',
125+
pinned: false,
126+
},
127+
{
128+
caption: 'Testsigma',
129+
image: '/img/users/testsigma.svg',
130+
infoLink: 'https://www.testsigma.com',
131+
pinned: false,
132+
},
133+
{
134+
caption: 'Tiller',
135+
image: '/img/users/tiller.svg',
136+
infoLink: 'https://www.tillersystems.com',
137+
pinned: false,
138+
},
139+
{
140+
caption: 'TravelPerk',
141+
image: '/img/users/travelperk.svg',
142+
infoLink: 'https://www.travelperk.com',
143+
pinned: false,
144+
},
145+
{
146+
caption: 'Velo Payments',
147+
image: '/img/users/velopayments.svg',
148+
infoLink: 'https://www.velopayments.com',
149+
pinned: false,
150+
},
151+
{
152+
caption: 'Walmart Labs',
119153
pinned: true,
154+
image: '/img/users/walmart.png',
155+
infoLink: 'https://www.walmartlabs.com/',
156+
},
157+
{
158+
caption: 'Wix.com',
159+
image: '/img/users/wix.svg',
160+
infoLink: 'https://www.wix.com',
161+
pinned: false,
120162
},
121163
{
122164
caption: 'Zup I.T. Innovation',
123165
image: '/img/users/zup.png',
124166
infoLink: 'https://www.zup.com.br/',
125-
pinned: true,
126-
},
127-
{
128-
caption: 'iFood',
129-
image: '/img/users/ifood.png',
130-
infoLink: 'https://www.ifood.com.br',
131-
pinned: true,
167+
pinned: false,
132168
},
133169
]
134170

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 57 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)