-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a logo carousel * Fix lint issues * fix: move helper outside of pages dir --------- Co-authored-by: Erick Zhao <[email protected]>
- Loading branch information
1 parent
e22c3c3
commit 98a3626
Showing
11 changed files
with
419 additions
and
116 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
src/pages/home/_components/FeaturedAppsCarousel.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
h2 { | ||
font-size: 2.5em; | ||
font-weight: 900; | ||
} | ||
|
||
.carouselContainer { | ||
width: 100%; | ||
overflow: hidden; | ||
position: relative; | ||
padding: 2rem 0; | ||
|
||
&::before, | ||
&::after { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
width: 5%; | ||
height: 100%; | ||
z-index: 1; | ||
} | ||
|
||
&::before { | ||
left: 0; | ||
background: linear-gradient(to right, #fff 0%, transparent 100%); | ||
|
||
[data-theme='dark'] & { | ||
background: linear-gradient( | ||
to right, | ||
var(--ifm-background-color) 0%, | ||
transparent 100% | ||
); | ||
} | ||
} | ||
|
||
&::after { | ||
right: 0; | ||
background: linear-gradient(to left, #fff 0%, transparent 100%); | ||
|
||
[data-theme='dark'] & { | ||
background: linear-gradient( | ||
to left, | ||
var(--ifm-background-color) 0%, | ||
transparent 100% | ||
); | ||
} | ||
} | ||
} | ||
|
||
.carouselTrack { | ||
display: flex; | ||
animation: scroll 30s linear infinite; | ||
|
||
&:hover { | ||
animation-play-state: paused; | ||
} | ||
} | ||
|
||
.customerLogo { | ||
flex-shrink: 0; | ||
padding: 0 2rem; | ||
|
||
img { | ||
height: 2.5rem; | ||
width: auto; | ||
opacity: 0.7; | ||
transition: opacity 0.3s ease; | ||
|
||
&:hover { | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
|
||
@keyframes scroll { | ||
0% { | ||
transform: translateX(0); | ||
} | ||
100% { | ||
// Move the track left by 50% since we duplicated the items | ||
transform: translateX(-50%); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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 { colorMode } = useColorMode(); | ||
const isDarkTheme = colorMode === 'dark'; | ||
|
||
return ( | ||
<div className={clsx(styles.section)}> | ||
<div style={{ textAlign: 'center', marginBottom: '6rem' }}> | ||
<h2>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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.