-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathFeaturedAppsCarousel.tsx
57 lines (53 loc) · 1.76 KB
/
FeaturedAppsCarousel.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from 'react';
import clsx from 'clsx';
import styles from './FeaturedAppsCarousel.module.scss';
import { useColorMode } from '@docusaurus/theme-common';
import type { FeaturedApp } from '../../../util/featured-apps';
interface FeaturedAppsCarouselProps {
list: FeaturedApp[];
}
export default function FeaturedAppsCarousel({
list,
}: FeaturedAppsCarouselProps) {
const [isDarkTheme, setIsDarkTheme] = React.useState(false);
const { colorMode } = useColorMode();
React.useEffect(() => {
setIsDarkTheme(colorMode === 'dark');
}, [colorMode]);
return (
<div className={clsx(styles.section)}>
<div style={{ textAlign: 'center', marginBottom: '6rem' }}>
<h2 className={styles.heading}>Trusted by best-in-class apps</h2>
<p>
{
'Popular consumer and rock-solid enterprise apps use Electron to power their desktop experiences.'
}
</p>
</div>
<div className={styles.carouselContainer}>
<div className={styles.carouselTrack}>
{/* Render list twice to create seamless loop */}
{[...list, ...list].map((app, index) => (
<div key={`${app.name}-${index}`} className={styles.customerLogo}>
<img
src={app.image}
alt={`${app.name} logo`}
title={app.name}
style={{
height: '3rem',
width: 'auto',
objectFit: 'contain',
filter: !app.isMonochrome
? isDarkTheme
? 'brightness(0) invert(1)'
: 'brightness(0)'
: undefined,
}}
/>
</div>
))}
</div>
</div>
</div>
);
}