Skip to content

Commit

Permalink
feat: Add a logo carousel (#676)
Browse files Browse the repository at this point in the history
* Add a logo carousel

* Fix lint issues

* fix: move helper outside of pages dir

---------

Co-authored-by: Erick Zhao <[email protected]>
  • Loading branch information
felixrieseberg and erickzhao authored Dec 9, 2024
1 parent e22c3c3 commit 98a3626
Show file tree
Hide file tree
Showing 11 changed files with 419 additions and 116 deletions.
82 changes: 82 additions & 0 deletions src/pages/home/_components/FeaturedAppsCarousel.module.scss
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%);
}
}
53 changes: 53 additions & 0 deletions src/pages/home/_components/FeaturedAppsCarousel.tsx
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>
);
}
121 changes: 5 additions & 116 deletions src/pages/home/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import InstallSteps from './_components/InstallSteps';
import Feature from './_components/Feature';
import TechnologiesGrid from './_components/TechnologiesGrid';
import CodeWindow from './_components/CodeWindow';
import FeaturedAppsCarousel from './_components/FeaturedAppsCarousel';

import { FEATURED_APPS, FEATURED_LOGOS } from '../../util/featured-apps';

export default function Home() {
const { siteConfig } = useDocusaurusContext();
Expand Down Expand Up @@ -69,6 +72,7 @@ export default function Home() {
</div>
</div>
</div>
<FeaturedAppsCarousel list={FEATURED_LOGOS} />
<div className={clsx(styles.section)}>
<div style={{ textAlign: 'center', marginBottom: '6rem' }}>
<h2>Desktop development made easy</h2>
Expand Down Expand Up @@ -343,122 +347,7 @@ export default function Home() {
Thousands of organizations spanning all industries use Electron to
build cross-platform software.
</p>
<AppsGrid
list={[
{
name: '1Password',
image: '/assets/apps/1password.svg',
href: 'https://1password.com/',
},
{
name: 'Asana',
image: '/assets/apps/asana.svg',
href: 'https://asana.com/',
},
{
name: 'Discord',
image: '/assets/apps/discord.svg',
href: 'https://discord.com/',
},
{
name: 'Dropbox',
image: '/assets/apps/dropbox.svg',
href: 'https://dropbox.com/',
},
{
name: 'Figma',
image: '/assets/apps/figma.svg',
href: 'https://figma.com/',
},
{
name: 'GitHub Desktop',
image: '/assets/apps/github-desktop.svg',
href: 'https://desktop.github.com/',
},
{
name: 'itch',
image: '/assets/apps/itchio.svg',
href: 'https://itch.io/app',
},
{
name: 'Loom',
image: '/assets/apps/loom.svg',
href: 'https://www.loom.com/',
},
{
name: 'MongoDB Compass',
image: '/assets/apps/mongodb.svg',
href: 'https://www.mongodb.com/products/compass',
},
{
name: 'Notion',
image: '/assets/apps/notion.svg',
href: 'https://www.notion.so/',
},
{
name: 'Obsidian',
image: '/assets/apps/obsidian.svg',
href: 'https://obsidian.md/',
},
{
name: 'Polypane',
image: '/assets/apps/polypane.svg',
href: 'https://polypane.app/',
},
{
name: 'Postman',
image: '/assets/apps/postman.svg',
href: 'https://postman.com/',
},
{
name: 'Signal',
image: '/assets/apps/signal.svg',
href: 'https://signal.org/en/',
},
{
name: 'Skype',
image: '/assets/apps/skype.svg',
href: 'https://skype.com/',
},
{
name: 'Slack',
image: '/assets/apps/slack.svg',
href: 'https://slack.com/',
},
{
name: 'Splice',
image: '/assets/apps/splice.svg',
isMonochrome: true,
href: 'https://splice.com/',
},
{
name: 'Microsoft Teams',
image: '/assets/apps/teams.svg',
href: 'https://microsoft.com/en-ca/microsoft-teams/group-chat-software/',
},
{
name: 'Tidal',
image: '/assets/apps/tidal.svg',
href: 'https://tidal.com',
isMonochrome: true,
},
{
name: 'Trello',
image: '/assets/apps/trello.svg',
href: 'https://trello.com/',
},
{
name: 'Twitch',
image: '/assets/apps/twitch.svg',
href: 'https://www.twitch.tv/',
},
{
name: 'VS Code',
image: '/assets/apps/vscode.svg',
href: 'https://code.visualstudio.com/',
},
]}
/>
<AppsGrid list={FEATURED_APPS} />
</div>
</div>
</main>
Expand Down
Loading

0 comments on commit 98a3626

Please sign in to comment.