diff --git a/libs/remix-ui/home-tab/src/lib/components/customButtonGroupAsArrows.tsx b/libs/remix-ui/home-tab/src/lib/components/customButtonGroupAsArrows.tsx deleted file mode 100644 index d265e5781d..0000000000 --- a/libs/remix-ui/home-tab/src/lib/components/customButtonGroupAsArrows.tsx +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import React from 'react' - -function CustomButtonGroupAsArrows ({ next, previous }) { - return ( -
-

These buttons can be positioned anywhere you want on the screen

- - -
- ) -} - -export default CustomButtonGroupAsArrows \ No newline at end of file diff --git a/libs/remix-ui/home-tab/src/lib/components/customNavButtons.tsx b/libs/remix-ui/home-tab/src/lib/components/customNavButtons.tsx index 9418051754..5596f314de 100644 --- a/libs/remix-ui/home-tab/src/lib/components/customNavButtons.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/customNavButtons.tsx @@ -1,8 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import React from 'react' -const CustomNavButtons = ({ next, previous, goToSlide, ...rest }) => { - const { carouselState: { currentSlide, totalItems, itemWidth, containerWidth } } = rest +const CustomNavButtons = ({ parent, next, previous, goToSlide, ...rest }) => { + const { carouselState: { currentSlide, totalItems, containerWidth, transform } } = rest + console.log("REST ", rest) + console.log("parent ", parent) return (
diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx index ca5232484d..5af5c58d73 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useState, useRef, useContext } from 'react' import { ThemeContext, themes } from '../themeContext' import Carousel from 'react-multi-carousel' import 'react-multi-carousel/lib/styles.css' -import CustomNavButtons from './customNavButtons' +import CustomButtonGroupDots from './customButtonGroupDots' const _paq = window._paq = window._paq || [] // eslint-disable-line function HomeTabFeatured() { @@ -14,6 +14,16 @@ function HomeTabFeatured() { } }, []) + const ButtonGroup = () => { + return ( + <> + + + + + ); + }; + return (
@@ -21,7 +31,7 @@ function HomeTabFeatured() {
} + customButtonGroup={} arrows={false} swipeable={false} draggable={true} @@ -31,6 +41,7 @@ function HomeTabFeatured() { ssr={true} // means to render carousel on server-side. infinite={true} centerMode={false} + partialVisible={false} autoPlay={true} keyBoardControl={true} containerClass="border carousel-container" diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx index 9fa324e9b2..97513bb050 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx @@ -20,7 +20,7 @@ interface HomeTabFeaturedPluginsProps { function HomeTabFeaturedPlugins ({plugin}: HomeTabFeaturedPluginsProps) { const themeFilter = useContext(ThemeContext) - const carouselRef = useRef(null) + const carouselRef = useRef({}) const carouselRefDiv = useRef(null) useEffect(() => { @@ -46,8 +46,9 @@ function HomeTabFeaturedPlugins ({plugin}: HomeTabFeaturedPluginsProps) { e.stopPropagation() let nextSlide = 0 if (e.wheelDelta < 0) { + console.log("scroll") nextSlide = carouselRef.current.state.currentSlide + 1; - if ((carouselRef.current.state.totalItems - carouselRef.current.state.currentSlide) * carouselRef.current.state.itemWidth + 5 < carouselRef.current.state.containerWidth) return // 5 is approx margins + if (Math.abs(carouselRef.current.state.transform) >= carouselRef.current.containerRef.current.scrollWidth - carouselRef.current.state.containerWidth) return carouselRef.current.goToSlide(nextSlide) } else { nextSlide = carouselRef.current.state.currentSlide - 1; @@ -92,7 +93,7 @@ function HomeTabFeaturedPlugins ({plugin}: HomeTabFeaturedPluginsProps) { ref={carouselRef} focusOnSelect={true} customButtonGroup={ - + } arrows={false} swipeable={false} diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx index ae6be5ad5c..aa65cf9dd7 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx @@ -17,7 +17,7 @@ interface HomeTabGetStartedProps { function HomeTabGetStarted ({plugin}: HomeTabGetStartedProps) { const themeFilter = useContext(ThemeContext) - const carouselRef = useRef(null) + const carouselRef = useRef({}) const carouselRefDiv = useRef(null) useEffect(() => { @@ -44,7 +44,7 @@ function HomeTabGetStarted ({plugin}: HomeTabGetStartedProps) { let nextSlide = 0 if (e.wheelDelta < 0) { nextSlide = carouselRef.current.state.currentSlide + 1; - if ((carouselRef.current.state.totalItems - carouselRef.current.state.currentSlide) * carouselRef.current.state.itemWidth + 5 < carouselRef.current.state.containerWidth) return // 5 is approx margins + if (Math.abs(carouselRef.current.state.transform) >= carouselRef.current.containerRef.current.scrollWidth - carouselRef.current.state.containerWidth) return carouselRef.current.goToSlide(nextSlide) } else { nextSlide = carouselRef.current.state.currentSlide - 1; @@ -77,7 +77,7 @@ function HomeTabGetStarted ({plugin}: HomeTabGetStartedProps) { ref={carouselRef} focusOnSelect={true} customButtonGroup={ - + } arrows={false} swipeable={false} diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabTitle.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabTitle.tsx index 60c2420067..0ca38dc338 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabTitle.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabTitle.tsx @@ -157,7 +157,7 @@ function HomeTabTitle() { ref={searchInputRef} type="text" className="border form-control border-right-0" - id="searchInput" + id="homeTabSearchInput" placeholder="Search Documentation" data-id="terminalInputSearch" />