diff --git a/nx-dev/ui-powerpack/src/lib/hero.tsx b/nx-dev/ui-powerpack/src/lib/hero.tsx index 8a6469ab1dbd4..b11237531360b 100644 --- a/nx-dev/ui-powerpack/src/lib/hero.tsx +++ b/nx-dev/ui-powerpack/src/lib/hero.tsx @@ -1,8 +1,32 @@ 'use client'; import { ButtonLink, SectionHeading, Strong } from '@nx/nx-dev/ui-common'; -import { ReactElement } from 'react'; +import { ReactElement, useState, useEffect } from 'react'; +import { Dialog, Transition } from '@headlessui/react'; + +const MOBILE_BREAKPOINT = 768; +const YOUTUBE_URL = 'https://youtu.be/KZ0nh2lj8zE?si=D1hkyP3vy36e-VZt'; export function Hero(): ReactElement { + const [isOpen, setIsOpen] = useState(false); + const [isMobile, setIsMobile] = useState(true); + + useEffect(() => { + const checkMobile = () => + setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); + checkMobile(); + window.addEventListener('resize', checkMobile); + return () => window.removeEventListener('resize', checkMobile); + }, []); + + const handleVideoClick = (e: React.MouseEvent) => { + e.preventDefault(); + if (isMobile) { + window.open(YOUTUBE_URL, '_blank'); + } else { + setIsOpen(true); + } + }; + return (
@@ -13,7 +37,7 @@ export function Hero(): ReactElement { A suite of paid extensions for the Nx CLI specifically designed for enterprises, built and supported by the Nx core team. -
+
Get Powerpack + + Watch the video{' '} + +
+ + {!isMobile && ( + setIsOpen(false)} + className="relative z-10" + > +
+
+
+ +