-
-
Notifications
You must be signed in to change notification settings - Fork 160
/
the-browser-buttons.tsx
40 lines (35 loc) · 984 Bytes
/
the-browser-buttons.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import cc from 'classcat'
import React from 'react'
import { useRecoilValue } from 'recoil'
import { browsersAtom } from '../atoms'
import BrowserButton from './browser-button'
const TheBrowserButtons: React.FC = () => {
const browsers = useRecoilValue(browsersAtom)
const threeCols = browsers.length <= 3 || browsers.length === 6
const fourCols =
browsers.length === 4 ||
browsers.length === 7 ||
browsers.length === 8 ||
browsers.length === 11 ||
browsers.length === 12
const fiveCols =
browsers.length === 5 ||
browsers.length === 9 ||
browsers.length === 10 ||
browsers.length >= 13
return (
<div
className={cc([
'grid gap-4',
{ 'grid-cols-3': threeCols },
{ 'grid-cols-4': fourCols },
{ 'grid-cols-5': fiveCols },
])}
>
{browsers.map((browser) => (
<BrowserButton key={browser.id} browser={browser} />
))}
</div>
)
}
export default TheBrowserButtons