/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /* eslint-disable global-require */ import React, {type ComponentProps, type ReactNode, useRef} from 'react'; import clsx from 'clsx'; import Link from '@docusaurus/Link'; import Image from '@theme/IdealImage'; import styles from './ShowcaseCarousel.module.css'; type Site = { name: string; image: ComponentProps['img']; url: string; }; function SiteSlide({index, site}: {index: number; site: Site}) { return (
{site.name} 🔗 {site.name}
); } // Inspired by: https://community.appsmith.com/content/blog/ditch-bloat-building-swipeable-carousel-only-css export default function ShowcaseCarousel({ sites, aspectRatio, }: { sites: Site[]; aspectRatio: number; }): ReactNode { const sliderRef = useRef(null); const scroll = (next: boolean) => { const sliderDiv = sliderRef.current!; const width = sliderDiv.offsetWidth; const scrollBy = next ? width : -width; sliderDiv.scrollBy({left: scrollBy, behavior: 'smooth'}); }; const scrollNext = () => scroll(true); const scrollPrev = () => scroll(false); return (
{sites.map((site, index) => { return (
); })}
); } export function ShowcaseCarouselV1(): ReactNode { return ( ); } export function ShowcaseCarouselV2(): ReactNode { return ( ); } export function ShowcaseCarouselV2Theming(): ReactNode { return ( ); }