feat: implement floating navbar with aurora background and updated header styling
This commit is contained in:
		@@ -1,12 +1,13 @@
 | 
			
		||||
import { useRef } from 'react'
 | 
			
		||||
import { motion, useInView } from 'framer-motion'
 | 
			
		||||
 | 
			
		||||
export function AnimatedSection({ children }: { children: React.ReactNode }) {
 | 
			
		||||
export function AnimatedSection({ children, id }: { children: React.ReactNode; id?: string }) {
 | 
			
		||||
  const ref = useRef(null)
 | 
			
		||||
  const isInView = useInView(ref, { once: true, margin: '-20% 0px -20% 0px' })
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <motion.section
 | 
			
		||||
      id={id}
 | 
			
		||||
      ref={ref}
 | 
			
		||||
      initial={{ opacity: 0, y: 50 }}
 | 
			
		||||
      animate={{
 | 
			
		||||
 
 | 
			
		||||
@@ -3,9 +3,9 @@ import clsx from 'clsx'
 | 
			
		||||
 | 
			
		||||
const baseStyles = {
 | 
			
		||||
  solid:
 | 
			
		||||
    'inline-flex justify-center rounded-lg py-2 px-3 text-sm font-semibold transition-colors',
 | 
			
		||||
    'inline-flex justify-center rounded-full py-2 px-4 text-sm font-semibold transition-colors',
 | 
			
		||||
  outline:
 | 
			
		||||
    'inline-flex justify-center rounded-lg border py-[calc(--spacing(2)-1px)] px-[calc(--spacing(3)-1px)] text-sm transition-colors',
 | 
			
		||||
    'inline-flex justify-center rounded-full border py-[calc(--spacing(2)-1px)] px-[calc(--spacing(4)-1px)] text-sm transition-colors',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const variantStyles = {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,44 +1,67 @@
 | 
			
		||||
'use client'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import { useEffect, useRef, useState } from 'react'
 | 
			
		||||
import { Link } from 'react-router-dom'
 | 
			
		||||
import { Container } from './Container'
 | 
			
		||||
import { AnimatePresence, motion } from 'framer-motion'
 | 
			
		||||
import clsx from 'clsx'
 | 
			
		||||
import { Button } from './Button'
 | 
			
		||||
 | 
			
		||||
export function Header() {
 | 
			
		||||
 | 
			
		||||
function NavLinks() {
 | 
			
		||||
  let [hoveredIndex, setHoveredIndex] = useState<number | null>(null)
 | 
			
		||||
  let timeoutRef = useRef<number | null>(null)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <header>
 | 
			
		||||
      <nav>
 | 
			
		||||
        <Container className="relative z-50 flex justify-between py-8">
 | 
			
		||||
          <div className="relative z-10 flex items-center gap-16">
 | 
			
		||||
            <Link to="/" aria-label="Home">
 | 
			
		||||
              <img src="/src/images/logomark.svg" alt="Mycelium" className="h-10 w-auto" />
 | 
			
		||||
            </Link>
 | 
			
		||||
            <div className="hidden lg:flex lg:gap-10">
 | 
			
		||||
              <Link
 | 
			
		||||
                to="/"
 | 
			
		||||
                className="text-base/7 tracking-tight text-gray-700 hover:text-cyan-500 transition-colors"
 | 
			
		||||
              >
 | 
			
		||||
                Home
 | 
			
		||||
              </Link>
 | 
			
		||||
              <Link
 | 
			
		||||
                to="/cloud"
 | 
			
		||||
                className="text-base/7 tracking-tight text-gray-700 hover:text-cyan-500 transition-colors"
 | 
			
		||||
              >
 | 
			
		||||
                Cloud
 | 
			
		||||
              </Link>
 | 
			
		||||
              <Link
 | 
			
		||||
                to="/network"
 | 
			
		||||
                className="text-base/7 tracking-tight text-gray-700 hover:text-cyan-500 transition-colors"
 | 
			
		||||
              >
 | 
			
		||||
                Network
 | 
			
		||||
              </Link>
 | 
			
		||||
              <Link
 | 
			
		||||
                to="/agents"
 | 
			
		||||
                className="text-base/7 tracking-tight text-gray-700 hover:text-cyan-500 transition-colors"
 | 
			
		||||
              >
 | 
			
		||||
                Agents
 | 
			
		||||
              </Link>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div className="flex items-center gap-6">
 | 
			
		||||
    <div className="flex items-center gap-x-5">
 | 
			
		||||
      <Link to="/" aria-label="Home">
 | 
			
		||||
        <img src="/src/images/logomark.svg" alt="Mycelium" className="h-10 w-auto" />
 | 
			
		||||
      </Link>
 | 
			
		||||
      <div className="flex items-center gap-x-5 border-l border-white/10 pl-5">
 | 
			
		||||
        {[
 | 
			
		||||
          ['Home', '/'],
 | 
			
		||||
          ['Cloud', '/cloud'],
 | 
			
		||||
          ['Network', '/network'],
 | 
			
		||||
          ['Agents', '/agents'],
 | 
			
		||||
        ].map(([label, href], index) => (
 | 
			
		||||
          <Link
 | 
			
		||||
            key={label}
 | 
			
		||||
            to={href}
 | 
			
		||||
            className={clsx(
 | 
			
		||||
              'relative rounded-lg px-3 py-2 text-sm text-black transition-colors delay-150 hover:text-cyan-500 hover:delay-0',
 | 
			
		||||
            )}
 | 
			
		||||
            onMouseEnter={() => {
 | 
			
		||||
              if (timeoutRef.current) {
 | 
			
		||||
                window.clearTimeout(timeoutRef.current)
 | 
			
		||||
              }
 | 
			
		||||
              setHoveredIndex(index)
 | 
			
		||||
            }}
 | 
			
		||||
            onMouseLeave={() => {
 | 
			
		||||
              timeoutRef.current = window.setTimeout(() => {
 | 
			
		||||
                setHoveredIndex(null)
 | 
			
		||||
              }, 200)
 | 
			
		||||
            }}
 | 
			
		||||
          >
 | 
			
		||||
            <AnimatePresence>
 | 
			
		||||
              {hoveredIndex === index && (
 | 
			
		||||
                <motion.span
 | 
			
		||||
                  className="absolute inset-0 rounded-lg bg-white/10"
 | 
			
		||||
                  layoutId="hoverBackground"
 | 
			
		||||
                  initial={{ opacity: 0 }}
 | 
			
		||||
                  animate={{ opacity: 1, transition: { duration: 0.15 } }}
 | 
			
		||||
                  exit={{
 | 
			
		||||
                    opacity: 0,
 | 
			
		||||
                    transition: { duration: 0.15 },
 | 
			
		||||
                  }}
 | 
			
		||||
                />
 | 
			
		||||
              )}
 | 
			
		||||
            </AnimatePresence>
 | 
			
		||||
            <span className="relative z-10">{label}</span>
 | 
			
		||||
          </Link>
 | 
			
		||||
        ))}
 | 
			
		||||
      </div>
 | 
			
		||||
       <div className="flex items-center gap-8">
 | 
			
		||||
            <div className="flex items-center gap-6 max-lg:hidden">
 | 
			
		||||
              <Button
 | 
			
		||||
                to="https://threefold.info/mycelium_network/docs/"
 | 
			
		||||
@@ -54,8 +77,48 @@ export function Header() {
 | 
			
		||||
              </Button>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </Container>
 | 
			
		||||
      </nav>
 | 
			
		||||
    </header>
 | 
			
		||||
    </div>
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export function Header() {
 | 
			
		||||
  const [isVisible, setIsVisible] = useState(true);
 | 
			
		||||
  const [lastScrollY, setLastScrollY] = useState(0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  const controlHeader = () => {
 | 
			
		||||
    if (typeof window !== 'undefined') {
 | 
			
		||||
      if (window.scrollY > lastScrollY && window.scrollY > 100) { // Hides when scrolling down past 100px
 | 
			
		||||
        setIsVisible(false);
 | 
			
		||||
      } else { // Shows when scrolling up
 | 
			
		||||
        setIsVisible(true);
 | 
			
		||||
      }
 | 
			
		||||
      setLastScrollY(window.scrollY);
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    if (typeof window !== 'undefined') {
 | 
			
		||||
      window.addEventListener('scroll', controlHeader);
 | 
			
		||||
      return () => {
 | 
			
		||||
        window.removeEventListener('scroll', controlHeader);
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
  }, [lastScrollY]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <motion.header 
 | 
			
		||||
      className="fixed top-4 left-0 right-0 z-50 flex justify-center"
 | 
			
		||||
      initial={{ y: 0, opacity: 1 }}
 | 
			
		||||
      animate={{ y: isVisible ? 0 : -100, opacity: isVisible ? 1 : 0 }}
 | 
			
		||||
      transition={{ duration: 0.3, ease: 'easeInOut' }}
 | 
			
		||||
    >
 | 
			
		||||
      <div className="rounded-full bg-white/10 px-5 py-3 shadow-lg ring-1 ring-white/10 backdrop-blur-sm">
 | 
			
		||||
        <NavLinks />
 | 
			
		||||
      </div>
 | 
			
		||||
    </motion.header>
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,16 @@
 | 
			
		||||
import { Outlet } from 'react-router-dom'
 | 
			
		||||
import { Header } from './Header'
 | 
			
		||||
import { FloatingNav } from './ui/floating-navbar'
 | 
			
		||||
import { Footer } from './Footer'
 | 
			
		||||
import { Header } from './Header'
 | 
			
		||||
 | 
			
		||||
export function Layout() {
 | 
			
		||||
  const navItems = [
 | 
			
		||||
    { name: 'Home', link: '/' },
 | 
			
		||||
    { name: 'Cloud', link: '/cloud' },
 | 
			
		||||
    { name: 'Network', link: '/network' },
 | 
			
		||||
    { name: 'Agents', link: '/agents' },
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <div className="bg-white antialiased" style={{ fontFamily: 'var(--font-inter)' }}>
 | 
			
		||||
      <Header />
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								src/components/ScrollDownArrow.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/components/ScrollDownArrow.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
'use client'
 | 
			
		||||
 | 
			
		||||
import { ChevronDown } from 'lucide-react'
 | 
			
		||||
 | 
			
		||||
export function ScrollDownArrow() {
 | 
			
		||||
  const scrollToNextSection = () => {
 | 
			
		||||
    const nextSection = document.querySelector('#next-section') // Assuming the next section has this id
 | 
			
		||||
    if (nextSection) {
 | 
			
		||||
      nextSection.scrollIntoView({ behavior: 'smooth' })
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <button
 | 
			
		||||
      onClick={scrollToNextSection}
 | 
			
		||||
      className="animate-bounce text-gray-500 hover:text-gray-700"
 | 
			
		||||
      aria-label="Scroll to next section"
 | 
			
		||||
    >
 | 
			
		||||
      <ChevronDown size={32} />
 | 
			
		||||
    </button>
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
@@ -3,6 +3,11 @@
 | 
			
		||||
import React from 'react'
 | 
			
		||||
import { cn } from '@/lib/utils'
 | 
			
		||||
 | 
			
		||||
const fontVariants = {
 | 
			
		||||
  sans: 'font-sans',
 | 
			
		||||
  neuton: 'font-neuton',
 | 
			
		||||
} as const
 | 
			
		||||
 | 
			
		||||
const colorVariants = {
 | 
			
		||||
  primary: 'text-gray-900',
 | 
			
		||||
  secondary: 'text-gray-600',
 | 
			
		||||
@@ -15,6 +20,7 @@ const colorVariants = {
 | 
			
		||||
} as const
 | 
			
		||||
 | 
			
		||||
type TextOwnProps = {
 | 
			
		||||
  font?: keyof typeof fontVariants
 | 
			
		||||
  color?: keyof typeof colorVariants
 | 
			
		||||
  className?: string
 | 
			
		||||
}
 | 
			
		||||
@@ -34,6 +40,7 @@ const createTextComponent = <DefaultElement extends React.ElementType>(
 | 
			
		||||
  >
 | 
			
		||||
 | 
			
		||||
  function Text<E extends React.ElementType = DefaultElement>({
 | 
			
		||||
    font = 'sans',
 | 
			
		||||
    as,
 | 
			
		||||
    color = 'primary',
 | 
			
		||||
    className,
 | 
			
		||||
@@ -43,7 +50,12 @@ const createTextComponent = <DefaultElement extends React.ElementType>(
 | 
			
		||||
    const Tag = (as || defaultElement) as React.ElementType
 | 
			
		||||
    return (
 | 
			
		||||
      <Tag
 | 
			
		||||
        className={cn(defaultClassName, colorVariants[color], className)}
 | 
			
		||||
        className={cn(
 | 
			
		||||
          defaultClassName,
 | 
			
		||||
          fontVariants[font],
 | 
			
		||||
          colorVariants[color],
 | 
			
		||||
          className
 | 
			
		||||
        )}
 | 
			
		||||
        {...props}
 | 
			
		||||
      >
 | 
			
		||||
        {children}
 | 
			
		||||
@@ -87,7 +99,7 @@ export const Subtle = createTextComponent(
 | 
			
		||||
)
 | 
			
		||||
export const H5 = createTextComponent(
 | 
			
		||||
  'h5',
 | 
			
		||||
  'text-xl lg:text-2xl font-semibold leading-snug tracking-tight'
 | 
			
		||||
  'text-xl lg:text-2xl font-light leading-snug tracking-normal'
 | 
			
		||||
)
 | 
			
		||||
export const Eyebrow = createTextComponent(
 | 
			
		||||
  'h2',
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ export function ScrollDown() {
 | 
			
		||||
  return (
 | 
			
		||||
    <button
 | 
			
		||||
      onClick={scrollToNext}
 | 
			
		||||
      className="fixed bottom-8 right-8 z-50 flex items-center gap-x-2 text-2xl font-medium text-white lg:text-3xl animate-blink"
 | 
			
		||||
      className="fixed bottom-8 right-8 z-50 flex items-center gap-x-2 rounded-full bg-black/20 p-2 text-2xl font-medium text-white backdrop-blur-sm lg:text-3xl animate-blink"
 | 
			
		||||
    >
 | 
			
		||||
      <span>scroll</span>
 | 
			
		||||
      <ChevronDoubleDownIcon className="h-6 w-6" />
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ export function ScrollUp() {
 | 
			
		||||
  return (
 | 
			
		||||
    <button
 | 
			
		||||
      onClick={scrollToTop}
 | 
			
		||||
      className="fixed bottom-8 right-8 z-50 flex items-center gap-x-2 text-2xl font-medium text-[#1c1c49] lg:text-3xl animate-blink"
 | 
			
		||||
      className="fixed bottom-8 right-8 z-50 flex items-center gap-x-2 rounded-full bg-white/20 p-2 text-2xl font-medium text-[#1c1c49] backdrop-blur-sm lg:text-3xl animate-blink"
 | 
			
		||||
    >
 | 
			
		||||
      <span>top</span>
 | 
			
		||||
      <ChevronDoubleUpIcon className="h-6 w-6" />
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								src/components/ui/aurora-background.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								src/components/ui/aurora-background.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
"use client";
 | 
			
		||||
import { cn } from "@/lib/utils";
 | 
			
		||||
import React, { ReactNode } from "react";
 | 
			
		||||
 | 
			
		||||
interface AuroraBackgroundProps extends React.HTMLProps<HTMLDivElement> {
 | 
			
		||||
  children: ReactNode;
 | 
			
		||||
  showRadialGradient?: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const AuroraBackground = ({
 | 
			
		||||
  className,
 | 
			
		||||
  children,
 | 
			
		||||
  showRadialGradient = true,
 | 
			
		||||
  ...props
 | 
			
		||||
}: AuroraBackgroundProps) => {
 | 
			
		||||
  return (
 | 
			
		||||
    <main>
 | 
			
		||||
      <div
 | 
			
		||||
                className={cn(
 | 
			
		||||
          "transition-bg relative flex h-[110vh] flex-col items-center justify-center bg-cover bg-center",
 | 
			
		||||
          className
 | 
			
		||||
        )}
 | 
			
		||||
        style={{
 | 
			
		||||
          backgroundImage: "url('/images/mchip.webp')",
 | 
			
		||||
        }}
 | 
			
		||||
        {...props}
 | 
			
		||||
      >
 | 
			
		||||
        <div
 | 
			
		||||
          className="absolute inset-0 overflow-hidden"
 | 
			
		||||
          style={
 | 
			
		||||
            {
 | 
			
		||||
              "--aurora":
 | 
			
		||||
                "repeating-linear-gradient(100deg,#3b82f6_10%,#a5b4fc_15%,#93c5fd_20%,#ddd6fe_25%,#60a5fa_30%)",
 | 
			
		||||
              "--dark-gradient":
 | 
			
		||||
                "repeating-linear-gradient(100deg,#000_0%,#000_7%,transparent_10%,transparent_12%,#000_16%)",
 | 
			
		||||
              "--white-gradient":
 | 
			
		||||
                "repeating-linear-gradient(100deg,#fff_0%,#fff_7%,transparent_10%,transparent_12%,#fff_16%)",
 | 
			
		||||
 | 
			
		||||
              "--blue-300": "#93c5fd",
 | 
			
		||||
              "--blue-400": "#60a5fa",
 | 
			
		||||
              "--blue-500": "#3b82f6",
 | 
			
		||||
              "--indigo-300": "#a5b4fc",
 | 
			
		||||
              "--violet-200": "#ddd6fe",
 | 
			
		||||
              "--black": "#000",
 | 
			
		||||
              "--white": "#fff",
 | 
			
		||||
              "--transparent": "transparent",
 | 
			
		||||
            } as React.CSSProperties
 | 
			
		||||
          }
 | 
			
		||||
        >
 | 
			
		||||
          <div
 | 
			
		||||
            //   I'm sorry but this is what peak developer performance looks like // trigger warning
 | 
			
		||||
            className={cn(
 | 
			
		||||
              `after:animate-aurora pointer-events-none absolute -inset-[10px] [background-image:var(--white-gradient),var(--aurora)] [background-size:300%,_200%] [background-position:50%_50%,50%_50%] opacity-50 blur-[10px] invert filter will-change-transform [--aurora:repeating-linear-gradient(100deg,var(--blue-500)_10%,var(--indigo-300)_15%,var(--blue-300)_20%,var(--violet-200)_25%,var(--blue-400)_30%)] [--dark-gradient:repeating-linear-gradient(100deg,var(--black)_0%,var(--black)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--black)_16%)] [--white-gradient:repeating-linear-gradient(100deg,var(--white)_0%,var(--white)_7%,var(--transparent)_10%,var(--transparent)_12%,var(--white)_16%)] after:absolute after:inset-0 after:[background-image:var(--white-gradient),var(--aurora)] after:[background-size:200%,_100%] after:[background-attachment:fixed] after:mix-blend-difference after:content-[""] dark:[background-image:var(--dark-gradient),var(--aurora)] dark:invert-0 after:dark:[background-image:var(--dark-gradient),var(--aurora)]`,
 | 
			
		||||
 | 
			
		||||
              showRadialGradient &&
 | 
			
		||||
                `[mask-image:radial-gradient(ellipse_at_100%_0%,black_10%,var(--transparent)_70%)]`,
 | 
			
		||||
            )}
 | 
			
		||||
          ></div>
 | 
			
		||||
        </div>
 | 
			
		||||
        {children}
 | 
			
		||||
      </div>
 | 
			
		||||
    </main>
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										90
									
								
								src/components/ui/floating-navbar.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								src/components/ui/floating-navbar.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,90 @@
 | 
			
		||||
"use client";
 | 
			
		||||
import { useState } from "react";
 | 
			
		||||
import {
 | 
			
		||||
  motion,
 | 
			
		||||
  AnimatePresence,
 | 
			
		||||
  useScroll,
 | 
			
		||||
  useMotionValueEvent,
 | 
			
		||||
} from "motion/react";
 | 
			
		||||
import { Link } from "react-router-dom";
 | 
			
		||||
import { cn } from "@/lib/utils";
 | 
			
		||||
import { Button } from "../Button";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const FloatingNav = ({
 | 
			
		||||
  navItems,
 | 
			
		||||
  className,
 | 
			
		||||
}: {
 | 
			
		||||
  navItems: {
 | 
			
		||||
    name: string;
 | 
			
		||||
    link: string;
 | 
			
		||||
    icon?: JSX.Element;
 | 
			
		||||
  }[];
 | 
			
		||||
  className?: string;
 | 
			
		||||
}) => {
 | 
			
		||||
  const { scrollYProgress } = useScroll();
 | 
			
		||||
 | 
			
		||||
  const [visible, setVisible] = useState(true);
 | 
			
		||||
 | 
			
		||||
  useMotionValueEvent(scrollYProgress, "change", (current) => {
 | 
			
		||||
    if (typeof current === "number") {
 | 
			
		||||
      const previous = scrollYProgress.getPrevious();
 | 
			
		||||
      // Check if previous is a number to avoid errors
 | 
			
		||||
      if (typeof previous === "number" && current > previous) {
 | 
			
		||||
        setVisible(false); // Scrolling down
 | 
			
		||||
      } else {
 | 
			
		||||
        setVisible(true); // Scrolling up or at the top
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  return (
 | 
			
		||||
    <AnimatePresence mode="wait">
 | 
			
		||||
      <motion.div
 | 
			
		||||
        initial={{
 | 
			
		||||
          opacity: 1,
 | 
			
		||||
          y: -100,
 | 
			
		||||
        }}
 | 
			
		||||
        animate={{
 | 
			
		||||
          y: visible ? 0 : -100,
 | 
			
		||||
          opacity: visible ? 1 : 0,
 | 
			
		||||
        }}
 | 
			
		||||
        transition={{
 | 
			
		||||
          duration: 0.2,
 | 
			
		||||
        }}
 | 
			
		||||
        className={cn(
 | 
			
		||||
          "flex max-w-fit  fixed top-10 inset-x-0 mx-auto border border-transparent dark:border-white/[0.2] rounded-xl dark:bg-black bg-gray-700/50 shadow-[0px_2px_3px_-1px_rgba(0,0,0,0.1),0px_1px_0px_0px_rgba(25,28,33,0.02),0px_0px_0px_1px_rgba(25,28,33,0.08)] z-[5000] pr-4 pl-8 py-2  items-center justify-center space-x-12",
 | 
			
		||||
          className
 | 
			
		||||
        )}
 | 
			
		||||
      >
 | 
			
		||||
        {navItems.map((navItem, idx: number) => (
 | 
			
		||||
          <Link
 | 
			
		||||
            key={`link=${idx}`}
 | 
			
		||||
            to={navItem.link}
 | 
			
		||||
            className={cn(
 | 
			
		||||
              "relative dark:text-neutral-50 items-center flex space-x-1 text-neutral-200 dark:hover:text-neutral-300 hover:text-cyan-500"
 | 
			
		||||
            )}
 | 
			
		||||
          >
 | 
			
		||||
            <span className="block sm:hidden">{navItem.icon}</span>
 | 
			
		||||
            <span className="hidden sm:block text-sm">{navItem.name}</span>
 | 
			
		||||
          </Link>
 | 
			
		||||
        ))}
 | 
			
		||||
        <div className="flex items-center gap-6">
 | 
			
		||||
          <a
 | 
			
		||||
            href="https://threefold.info/mycelium_network/docs/"
 | 
			
		||||
            target="_blank"
 | 
			
		||||
            rel="noopener noreferrer"
 | 
			
		||||
            className={cn(
 | 
			
		||||
              "relative dark:text-neutral-50 items-center flex space-x-1 text-neutral-200 dark:hover:text-neutral-300 hover:text-cyan-500"
 | 
			
		||||
            )}
 | 
			
		||||
          >
 | 
			
		||||
            <span className="hidden sm:block text-sm">Docs</span>
 | 
			
		||||
          </a>
 | 
			
		||||
          <Button to="/download" variant="solid" color="cyan">
 | 
			
		||||
            Get Mycelium
 | 
			
		||||
          </Button>
 | 
			
		||||
        </div>
 | 
			
		||||
      </motion.div>
 | 
			
		||||
    </AnimatePresence>
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										104
									
								
								src/components/ui/lamp.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								src/components/ui/lamp.tsx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,104 @@
 | 
			
		||||
"use client";
 | 
			
		||||
import React from "react";
 | 
			
		||||
import { motion } from "motion/react";
 | 
			
		||||
import { cn } from "@/lib/utils";
 | 
			
		||||
 | 
			
		||||
export default function LampDemo() {
 | 
			
		||||
  return (
 | 
			
		||||
    <LampContainer>
 | 
			
		||||
      <motion.h1
 | 
			
		||||
        initial={{ opacity: 0.5, y: 100 }}
 | 
			
		||||
        whileInView={{ opacity: 1, y: 0 }}
 | 
			
		||||
        transition={{
 | 
			
		||||
          delay: 0.3,
 | 
			
		||||
          duration: 0.8,
 | 
			
		||||
          ease: "easeInOut",
 | 
			
		||||
        }}
 | 
			
		||||
        className="mt-8 bg-gradient-to-br from-gray-300 to-gray-500 py-4 bg-clip-text text-center text-4xl font-medium tracking-tight text-transparent md:text-7xl"
 | 
			
		||||
      >
 | 
			
		||||
        Build lamps <br /> the right way
 | 
			
		||||
      </motion.h1>
 | 
			
		||||
    </LampContainer>
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const LampContainer = ({
 | 
			
		||||
  children,
 | 
			
		||||
  className,
 | 
			
		||||
}: {
 | 
			
		||||
  children: React.ReactNode;
 | 
			
		||||
  className?: string;
 | 
			
		||||
}) => {
 | 
			
		||||
  return (
 | 
			
		||||
    <div
 | 
			
		||||
      className={cn(
 | 
			
		||||
        "relative flex h-screen flex-col items-center justify-start pt-32 overflow-hidden bg-gray-950 w-full z-0",
 | 
			
		||||
        className
 | 
			
		||||
      )}
 | 
			
		||||
    >
 | 
			
		||||
      <div className="relative flex w-full flex-1 scale-y-125 items-center justify-center isolate z-0 ">
 | 
			
		||||
        <motion.div
 | 
			
		||||
          initial={{ opacity: 0.5, width: "15rem" }}
 | 
			
		||||
          whileInView={{ opacity: 1, width: "30rem" }}
 | 
			
		||||
          transition={{
 | 
			
		||||
            delay: 0.5,
 | 
			
		||||
            duration: 1.0,
 | 
			
		||||
            ease: "easeInOut",
 | 
			
		||||
          }}
 | 
			
		||||
          style={{
 | 
			
		||||
            backgroundImage: `conic-gradient(var(--conic-position), var(--tw-gradient-stops))`,
 | 
			
		||||
          }}
 | 
			
		||||
          className="absolute inset-auto right-1/2 h-56 overflow-visible w-[30rem] bg-gradient-conic from-cyan-500 via-transparent to-transparent text-white [--conic-position:from_70deg_at_center_top]"
 | 
			
		||||
        >
 | 
			
		||||
          <div className="absolute  w-[100%] left-0 bg-gray-950 h-40 bottom-0 z-20 [mask-image:linear-gradient(to_top,white,transparent)]" />
 | 
			
		||||
          <div className="absolute  w-40 h-[100%] left-0 bg-gray-950  bottom-0 z-20 [mask-image:linear-gradient(to_right,white,transparent)]" />
 | 
			
		||||
        </motion.div>
 | 
			
		||||
        <motion.div
 | 
			
		||||
          initial={{ opacity: 0.5, width: "15rem" }}
 | 
			
		||||
          whileInView={{ opacity: 1, width: "30rem" }}
 | 
			
		||||
          transition={{
 | 
			
		||||
            delay: 0.3,
 | 
			
		||||
            duration: 0.8,
 | 
			
		||||
            ease: "easeInOut",
 | 
			
		||||
          }}
 | 
			
		||||
          style={{
 | 
			
		||||
            backgroundImage: `conic-gradient(var(--conic-position), var(--tw-gradient-stops))`,
 | 
			
		||||
          }}
 | 
			
		||||
          className="absolute inset-auto left-1/2 h-56 w-[30rem] bg-gradient-conic from-transparent via-transparent to-cyan-500 text-white [--conic-position:from_290deg_at_center_top]"
 | 
			
		||||
        >
 | 
			
		||||
          <div className="absolute  w-40 h-[100%] right-0 bg-gray-950  bottom-0 z-20 [mask-image:linear-gradient(to_left,white,transparent)]" />
 | 
			
		||||
          <div className="absolute  w-[100%] right-0 bg-gray-950 h-40 bottom-0 z-20 [mask-image:linear-gradient(to_top,white,transparent)]" />
 | 
			
		||||
        </motion.div>
 | 
			
		||||
        <div className="absolute top-1/2 h-48 w-full translate-y-12 scale-x-150 bg-gray-950 blur-2xl"></div>
 | 
			
		||||
        <div className="absolute top-1/2 z-50 h-48 w-full bg-transparent opacity-10 backdrop-blur-md"></div>
 | 
			
		||||
        <div className="absolute inset-auto z-50 h-36 w-[28rem] -translate-y-1/2 rounded-full bg-cyan-500 opacity-50 blur-3xl"></div>
 | 
			
		||||
        <motion.div
 | 
			
		||||
          initial={{ width: "8rem" }}
 | 
			
		||||
          whileInView={{ width: "16rem" }}
 | 
			
		||||
          transition={{
 | 
			
		||||
            delay: 0.3,
 | 
			
		||||
            duration: 0.8,
 | 
			
		||||
            ease: "easeInOut",
 | 
			
		||||
          }}
 | 
			
		||||
          className="absolute inset-auto z-30 h-36 w-64 -translate-y-[6rem] rounded-full bg-cyan-400 blur-2xl"
 | 
			
		||||
        ></motion.div>
 | 
			
		||||
        <motion.div
 | 
			
		||||
          initial={{ width: "15rem" }}
 | 
			
		||||
          whileInView={{ width: "30rem" }}
 | 
			
		||||
          transition={{
 | 
			
		||||
            delay: 0.3,
 | 
			
		||||
            duration: 0.8,
 | 
			
		||||
            ease: "easeInOut",
 | 
			
		||||
          }}
 | 
			
		||||
          className="absolute inset-auto z-50 h-0.5 w-[30rem] -translate-y-[7rem] bg-cyan-400 "
 | 
			
		||||
        ></motion.div>
 | 
			
		||||
 | 
			
		||||
        <div className="absolute inset-auto z-40 h-44 w-full -translate-y-[12.5rem] bg-gray-950 "></div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <div className="relative z-50 flex -translate-y-32 flex-col items-center px-5">
 | 
			
		||||
        {children}
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  );
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user