A drawer component for React.
Hero fix
emilkowalskib89d0427c8d2
diff --git a/website/src/app/components/hero.tsx b/website/src/app/components/hero.tsxindex a292446..732f540 100644--- a/website/src/app/components/hero.tsx+++ b/website/src/app/components/hero.tsx@@ -1,12 +1,8 @@'use client';-import { useState } from 'react';import { Drawer } from 'vaul';-import { clsx } from 'clsx';export function Hero() {- const [snap, setSnap] = useState<number | string | null>('148px');-return (<div className="relative"><div@@ -44,139 +40,100 @@ export function Hero() {<p className="text-gray-600 text-xl">Drawer component for React.</p></div><div className="flex gap-4 justify-center mt-6">- <Drawer.Root- snapPoints={['148px', '355px', 1]}- dismissible={false}- activeSnapPoint={snap}- setActiveSnapPoint={setSnap}- >+ <Drawer.Root shouldScaleBackground><Drawer.Trigger asChild>- <button>Open Drawer</button>+ <button+ type="button"+ className="rounded-full bg-white px-4 py-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50"+ >+ Open Drawer+ </button></Drawer.Trigger>- <Drawer.Overlay className="fixed inset-0 bg-black/40" /><Drawer.Portal>- <Drawer.Content className="fixed flex flex-col bg-white border border-gray-200 border-b-none rounded-t-[10px] bottom-0 left-0 right-0 h-full max-h-[97%] mx-[-1px]">- <div- className={clsx('flex flex-col max-w-md mx-auto w-full p-4 pt-5', {- 'overflow-y-auto': snap === 1,- 'overflow-hidden': snap !== 1,- })}- >- <div className="flex items-center">- <svg- className="text-yellow-400 h-5 w-5 flex-shrink-0"- viewBox="0 0 20 20"- fill="currentColor"- aria-hidden="true"- >- <path- fill-rule="evenodd"- d="M10.868 2.884c-.321-.772-1.415-.772-1.736 0l-1.83 4.401-4.753.381c-.833.067-1.171 1.107-.536 1.651l3.62 3.102-1.106 4.637c-.194.813.691 1.456 1.405 1.02L10 15.591l4.069 2.485c.713.436 1.598-.207 1.404-1.02l-1.106-4.637 3.62-3.102c.635-.544.297-1.584-.536-1.65l-4.752-.382-1.831-4.401z"- clip-rule="evenodd"- ></path>- </svg>- <svg- className="text-yellow-400 h-5 w-5 flex-shrink-0"- viewBox="0 0 20 20"- fill="currentColor"- aria-hidden="true"- >- <path- fill-rule="evenodd"- d="M10.868 2.884c-.321-.772-1.415-.772-1.736 0l-1.83 4.401-4.753.381c-.833.067-1.171 1.107-.536 1.651l3.62 3.102-1.106 4.637c-.194.813.691 1.456 1.405 1.02L10 15.591l4.069 2.485c.713.436 1.598-.207 1.404-1.02l-1.106-4.637 3.62-3.102c.635-.544.297-1.584-.536-1.65l-4.752-.382-1.831-4.401z"- clip-rule="evenodd"- ></path>- </svg>- <svg- className="text-yellow-400 h-5 w-5 flex-shrink-0"- viewBox="0 0 20 20"- fill="currentColor"- aria-hidden="true"- >- <path- fill-rule="evenodd"- d="M10.868 2.884c-.321-.772-1.415-.772-1.736 0l-1.83 4.401-4.753.381c-.833.067-1.171 1.107-.536 1.651l3.62 3.102-1.106 4.637c-.194.813.691 1.456 1.405 1.02L10 15.591l4.069 2.485c.713.436 1.598-.207 1.404-1.02l-1.106-4.637 3.62-3.102c.635-.544.297-1.584-.536-1.65l-4.752-.382-1.831-4.401z"- clip-rule="evenodd"- ></path>- </svg>- <svg- className="text-yellow-400 h-5 w-5 flex-shrink-0"- viewBox="0 0 20 20"- fill="currentColor"- aria-hidden="true"+ <Drawer.Overlay className="fixed inset-0 bg-black/40" />+ <Drawer.Content className="bg-gray-100 flex flex-col rounded-t-[10px] h-full mt-24 max-h-[96%] fixed bottom-0 left-0 right-0">+ <div className="p-4 bg-white rounded-t-[10px] flex-1">+ <div className="mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-8" />+ <div className="max-w-md mx-auto">+ <Drawer.Title className="font-medium mb-4">Drawer for React.</Drawer.Title>+ <p className="text-gray-600 mb-2">+ This component can be used as a Dialog replacement on mobile and tablet devices.+ </p>+ <p className="text-gray-600 mb-2">+ It comes unstyled, has gesture-driven animations, and is made by{' '}+ <a href="https://emilkowal.ski/" className="underline" target="_blank">+ Emil Kowalski+ </a>+ .+ </p>+ <p className="text-gray-600 mb-8">+ It uses{' '}+ <a+ href="https://www.radix-ui.com/docs/primitives/components/dialog"+ className="underline"+ target="_blank"+ >+ Radix's Dialog primitive+ </a>{' '}+ under the hood and is inspired by{' '}+ <a+ href="https://twitter.com/devongovett/status/1674470185783402496"+ className="underline"+ target="_blank"+ >+ this tweet.+ </a>+ </p>+ </div>+ </div>+ <div className="p-4 bg-gray-100 border-t border-gray-200 mt-auto">+ <div className="flex gap-6 justify-end max-w-md mx-auto">+ <a+ className="text-xs text-gray-600 flex items-center gap-0.25"+ href="https://github.com/emilkowalski/vaul"+ target="_blank">- <path- fill-rule="evenodd"- d="M10.868 2.884c-.321-.772-1.415-.772-1.736 0l-1.83 4.401-4.753.381c-.833.067-1.171 1.107-.536 1.651l3.62 3.102-1.106 4.637c-.194.813.691 1.456 1.405 1.02L10 15.591l4.069 2.485c.713.436 1.598-.207 1.404-1.02l-1.106-4.637 3.62-3.102c.635-.544.297-1.584-.536-1.65l-4.752-.382-1.831-4.401z"- clip-rule="evenodd"- ></path>- </svg>- <svg- className="text-gray-300 h-5 w-5 flex-shrink-0"- viewBox="0 0 20 20"- fill="currentColor"- aria-hidden="true"+ GitHub+ <svg+ fill="none"+ height="16"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2"+ viewBox="0 0 24 24"+ width="16"+ aria-hidden="true"+ className="w-3 h-3 ml-1"+ >+ <path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"></path>+ <path d="M15 3h6v6"></path>+ <path d="M10 14L21 3"></path>+ </svg>+ </a>+ <a+ className="text-xs text-gray-600 flex items-center gap-0.25"+ href="https://twitter.com/emilkowalski_"+ target="_blank">- <path- fill-rule="evenodd"- d="M10.868 2.884c-.321-.772-1.415-.772-1.736 0l-1.83 4.401-4.753.381c-.833.067-1.171 1.107-.536 1.651l3.62 3.102-1.106 4.637c-.194.813.691 1.456 1.405 1.02L10 15.591l4.069 2.485c.713.436 1.598-.207 1.404-1.02l-1.106-4.637 3.62-3.102c.635-.544.297-1.584-.536-1.65l-4.752-.382-1.831-4.401z"- clip-rule="evenodd"- ></path>- </svg>- </div>{' '}- <h1 className="text-2xl mt-2 font-medium">The Hidden Details</h1>- <p className="text-sm mt-1 text-gray-600 mb-6">2 modules, 27 hours of video</p>- <p className="text-gray-600">- The world of user interface design is an intricate landscape filled with hidden details and nuance.- In this course, you will learn something cool. To the untrained eye, a beautifully designed UI.- </p>- <button className="bg-black text-gray-50 mt-8 rounded-md h-[48px] flex-shrink-0 font-medium">- Buy for $199- </button>- <div className="mt-12">- <h2 className="text-xl font-medium">Module 01. The Details</h2>- <div className="space-y-4 mt-4">- <div>- <span className="block">Layers of UI</span>- <span className="text-gray-600">A basic introduction to Layers of Design.</span>- </div>- <div>- <span className="block">Typography</span>- <span className="text-gray-600">The fundamentals of type.</span>- </div>- <div>- <span className="block">UI Animations</span>- <span className="text-gray-600">Going through the right easings and durations.</span>- </div>- </div>- </div>- <div className="mt-12">- <figure>- <blockquote className="font-serif">- “I especially loved the hidden details video. That was so useful, learned a lot by just reading- it. Can’t wait for more course content!”- </blockquote>- <figcaption>- <span className="text-sm text-gray-600 mt-2 block">Yvonne Ray, Frontend Developer</span>- </figcaption>- </figure>- </div>- <div className="mt-12">- <h2 className="text-xl font-medium">Module 02. The Process</h2>- <div className="space-y-4 mt-4">- <div>- <span className="block">Build</span>- <span className="text-gray-600">Create cool components to practice.</span>- </div>- <div>- <span className="block">User Insight</span>- <span className="text-gray-600">Find out what users think and fine-tune.</span>- </div>- <div>- <span className="block">Putting it all together</span>- <span className="text-gray-600">Let's build an app together and apply everything.</span>- </div>- </div>+ <svg+ fill="none"+ height="16"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2"+ viewBox="0 0 24 24"+ width="16"+ aria-hidden="true"+ className="w-3 h-3 ml-1"+ >+ <path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"></path>+ <path d="M15 3h6v6"></path>+ <path d="M10 14L21 3"></path>+ </svg>+ </a></div></div></Drawer.Content>