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 f298eba01d..4791e600d3 100644 --- a/libs/remix-ui/home-tab/src/lib/components/customNavButtons.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/customNavButtons.tsx @@ -2,15 +2,24 @@ import React from 'react' const CustomNavButtons = ({ next, previous, goToSlide, ...rest }) => { - const { carouselState: { currentSlide, totalItems } } = rest + const { carouselState: { currentSlide, totalItems, itemWidth, containerWidth } } = rest 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 8741d7779f..18798c3f4f 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx @@ -18,7 +18,7 @@ function HomeTabFeatured() {
- + } arrows={false} @@ -40,26 +40,31 @@ function HomeTabFeatured() { dotListClass="position-relative mt-2" >
- -
+ +
JUMP INTO WEB3
- The Remix Project is a rich toolset which can be used for the entire journey of contract development by users of any knowledge level, and as a learning lab for teaching and experimenting with Ethereum. +

The Remix Project is a rich toolset which can be used for the entire journey of contract development by users of any knowledge level, and as a learning lab for teaching and experimenting with Ethereum.

+ More
-
+
REMIX REWARDS
-

NFTs for our users!

- Remix Project rewards contributors, beta testers, and UX research participants with NFTs deployed on Optimism. Remix Reward holders are able to mint a second “Remixer” user NFT badge to give to any other user of their choice +

NFTs for our users!

+

+ Remix Project rewards contributors, beta testers, and UX research participants with NFTs deployed on Optimism. Remix Reward holders are able to mint a second “Remixer” user NFT badge to give to any other user of their choice. +

+ More
-
+
BETA TESTING
-

Our community supports us.

- You can join Beta Testing before each release of Remix IDE. Help us test now and get a handle on new features! +

Our community supports us.

+

You can join Beta Testing before each release of Remix IDE. Help us test now and get a handle on new features!

+ More
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 84b2fb4f57..41a4d8f36c 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabFeaturedPlugins.tsx @@ -5,6 +5,7 @@ import { ThemeContext, themes } from '../themeContext' import Carousel from 'react-multi-carousel' import 'react-multi-carousel/lib/styles.css' import CustomNavButtons from './customNavButtons' +const itemsToShow = 5 declare global { interface Window { _paq: any @@ -20,16 +21,39 @@ function HomeTabFeaturedPlugins ({plugin}: HomeTabFeaturedPluginsProps) { const themeFilter = useContext(ThemeContext) const carouselRef = useRef(null) + const carouselRefDiv = useRef(null) - // Todo doesn't work useEffect(() => { - window.addEventListener("scroll", handleScroll) + document.addEventListener("wheel", handleScroll) return () => { - window.removeEventListener("scroll", handleScroll) + document.removeEventListener("wheel", handleScroll) } }, []) + function isDescendant(parent, child) { + let node = child.parentNode; + while (node != null) { + if (node === parent) { + return true; + } + node = node.parentNode; + } + return false; +} const handleScroll = (e) => { + if (isDescendant(carouselRefDiv.current, e.target)) { + e.stopPropagation() + 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 + carouselRef.current.goToSlide(nextSlide) + } else { + nextSlide = carouselRef.current.state.currentSlide - 1; + if (nextSlide < 0) nextSlide = 0 + carouselRef.current.goToSlide(nextSlide) + } + } } const startSolidity = async () => { @@ -61,17 +85,30 @@ function HomeTabFeaturedPlugins ({plugin}: HomeTabFeaturedPluginsProps) { return (
-
+
} + focusOnSelect={true} + customButtonGroup={ + + } arrows={false} swipeable={false} draggable={true} showDots={false} - responsive={{ desktop: { breakpoint: { max: 3000, min: 1024 }, items: 5} }} + responsive={ + { + superLargeDesktop: { + breakpoint: { max: 4000, min: 3000 }, + items: itemsToShow + }, + desktop: { + breakpoint: { max: 3000, min: 1024 }, + items: itemsToShow + } + } + } renderButtonGroupOutside={true} ssr={true} // means to render carousel on server-side. keyBoardControl={true} 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 f27f489198..b3bd1cd3b5 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabGetStarted.tsx @@ -18,6 +18,41 @@ interface HomeTabGetStartedProps { function HomeTabGetStarted ({plugin}: HomeTabGetStartedProps) { const themeFilter = useContext(ThemeContext) + const carouselRef = useRef(null) + const carouselRefDiv = useRef(null) + + useEffect(() => { + document.addEventListener("wheel", handleScroll) + return () => { + document.removeEventListener("wheel", handleScroll) + } + }, []) + + function isDescendant(parent, child) { + let node = child.parentNode; + while (node != null) { + if (node === parent) { + return true; + } + node = node.parentNode; + } + return false; +} + const handleScroll = (e) => { + if (isDescendant(carouselRefDiv.current, e.target)) { + e.stopPropagation() + 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 + carouselRef.current.goToSlide(nextSlide) + } else { + nextSlide = carouselRef.current.state.currentSlide - 1; + if (nextSlide < 0) nextSlide = 0 + carouselRef.current.goToSlide(nextSlide) + } + } + } const createWorkspace = async (templateName) => { await plugin.appManager.activatePlugin('filePanel') @@ -36,16 +71,31 @@ function HomeTabGetStarted ({plugin}: HomeTabGetStartedProps) { - Project Templates -
+
- } + + } arrows={false} swipeable={false} draggable={true} showDots={false} - responsive={{ desktop: { breakpoint: { max: 3000, min: 1024 }, items: 5} }} + responsive={ + { + superLargeDesktop: { + breakpoint: { max: 4000, min: 3000 }, + items: 5 + }, + desktop: { + breakpoint: { max: 3000, min: 1024 }, + items: 5, + partialVisibilityGutter: 0 + } + } + } renderButtonGroupOutside={true} ssr={true} // means to render carousel on server-side. keyBoardControl={true} diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabLearn.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabLearn.tsx index 0fdc6ab5ff..e9d1a345b3 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabLearn.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabLearn.tsx @@ -50,20 +50,20 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) {
}
}
} diff --git a/libs/remix-ui/home-tab/src/lib/components/pluginButton.tsx b/libs/remix-ui/home-tab/src/lib/components/pluginButton.tsx index 803c9f7ec4..8a8470304d 100644 --- a/libs/remix-ui/home-tab/src/lib/components/pluginButton.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/pluginButton.tsx @@ -23,7 +23,7 @@ function PluginButton ({ imgPath, envID, envText, callback, l2, description, rem onClick={() => callback()} > -
+
{description}
diff --git a/libs/remix-ui/home-tab/src/lib/components/workspaceTemplate.tsx b/libs/remix-ui/home-tab/src/lib/components/workspaceTemplate.tsx index ad079053a8..4610236f79 100644 --- a/libs/remix-ui/home-tab/src/lib/components/workspaceTemplate.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/workspaceTemplate.tsx @@ -16,7 +16,7 @@ function WorkspaceTemplate ({ gsID, workspaceTitle, description, callback }: Wor data-id={'landingPageStart' + gsID} onClick={() => callback()} > -
+
{description}
diff --git a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css index d6ced30e67..011a179161 100644 --- a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css +++ b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css @@ -1,11 +1,9 @@ .remixui_home_text { - cursor: pointer; font-size: 0.8rem; font-weight: normal; max-width: 300px; } .remixui_home_text:hover { - cursor: pointer; text-decoration: underline; } .remixui_home_homeContainer {