Files
next.js/examples/radix-ui/app/page.tsx
Arian Tron 61f56f997c
Some checks failed
Test examples / Test Examples (20) (push) Has been cancelled
Test examples / Test Examples (22) (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Trigger Release / start (push) Has been cancelled
Stale issue handler / stale (push) Has been cancelled
Update Font Data / create-pull-request (push) Has been cancelled
build-and-deploy / deploy-target (push) Has been cancelled
build-and-deploy / build (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / build-wasm (nodejs) (push) Has been cancelled
build-and-deploy / build-wasm (web) (push) Has been cancelled
build-and-deploy / Deploy preview tarball (push) Has been cancelled
build-and-deploy / Potentially publish release (push) Has been cancelled
build-and-deploy / publish-turbopack-npm-packages (push) Has been cancelled
build-and-deploy / Deploy examples (push) Has been cancelled
build-and-deploy / thank you, build (push) Has been cancelled
build-and-deploy / Upload Turbopack Bytesize metrics to Datadog (push) Has been cancelled
Rspack Next.js development integration tests / Rspack integration tests (push) Has been cancelled
Rspack Next.js production integration tests / Rspack integration tests (push) Has been cancelled
Turbopack Next.js development integration tests / Next.js integration tests (push) Has been cancelled
Turbopack Next.js production integration tests / Next.js integration tests (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack development test manifest (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack production test manifest (push) Has been cancelled
Upload bundler test manifests to areweturboyet.com / Upload test results (push) Has been cancelled
Update React / create-pull-request (push) Has been cancelled
test-e2e-project-reset-cron / reset-test-project (push) Has been cancelled
Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days / run (push) Has been cancelled
first commit
2026-03-10 19:37:31 +03:30

177 lines
5.5 KiB
TypeScript

"use client";
import { useState } from "react";
import {
HamburgerMenuIcon,
DotFilledIcon,
CheckIcon,
ChevronRightIcon,
} from "@radix-ui/react-icons";
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
function RightSlot({ children }) {
return (
<div className="ml-auto pl-4 text-gray-500 group-hover:text-gray-200">
{children}
</div>
);
}
function DropdownMenuItem({ children, ...props }) {
return (
<DropdownMenu.Item
{...props}
className={
"group bg-white hover:bg-gray-700 hover:text-gray-200 text-xs rounded flex items-center h-6 px-1 pl-6 relative select-none" +
(props.disabled ? " text-gray-500" : "")
}
>
{children}
</DropdownMenu.Item>
);
}
function DropdownMenuCheckboxItem({ children, ...props }) {
return (
<DropdownMenu.CheckboxItem
{...props}
className="group bg-white hover:bg-gray-700 hover:text-gray-200 text-xs rounded flex items-center h-6 px-1 pl-6 relative select-none"
>
{children}
</DropdownMenu.CheckboxItem>
);
}
function DropdownMenuItemIndicator({ children, ...props }) {
return (
<DropdownMenu.ItemIndicator
{...props}
className="absolute left-0 w-6 inline-flex items-center justify-center"
>
{children}
</DropdownMenu.ItemIndicator>
);
}
function Separator() {
return <DropdownMenu.Separator className="h-[1px] bg-gray-300 m-1" />;
}
function DropdownMenuRadioItem({
children,
...props
}: {
children: React.ReactNode;
value: string;
}) {
return (
<DropdownMenu.RadioItem
{...props}
className="bg-white hover:bg-gray-700 hover:text-gray-200 text-xs rounded flex items-center h-6 px-1 pl-6 relative select-none"
>
{children}
</DropdownMenu.RadioItem>
);
}
export default function Home() {
const [bookmarksChecked, setBookmarksChecked] = useState(true);
const [urlsChecked, setUrlsChecked] = useState(false);
const [person, setPerson] = useState("pedro");
return (
<div className="h-screen w-full flex flex-col space-y-4 items-center justify-center bg-gradient-to-r from-cyan-500 to-blue-500">
<h1 className="text-6xl text-white font-semibold">
Radix UI + Tailwind CSS
</h1>
<h1 className="text-4xl text-white font-semibold">Click me!</h1>
<DropdownMenu.Root>
<DropdownMenu.Trigger
asChild
className="bg-white text-xs rounded-3xl flex items-center h-8 px-2 relative select-none"
>
<button
aria-label="Customise options"
className="h-8 w-8 inline-flex items-center justify-center shadow-lg"
>
<HamburgerMenuIcon />
</button>
</DropdownMenu.Trigger>
<DropdownMenu.Content
sideOffset={5}
className="bg-white rounded p-1 shadow-lg"
>
<DropdownMenuItem>
New Tab <RightSlot>+T</RightSlot>
</DropdownMenuItem>
<DropdownMenuItem>
New Window <RightSlot>+N</RightSlot>
</DropdownMenuItem>
<DropdownMenuItem disabled>
New Private Window <RightSlot>++N</RightSlot>
</DropdownMenuItem>
<DropdownMenu.Sub>
<DropdownMenu.SubTrigger className="group bg-white hover:bg-gray-700 hover:text-gray-200 hover:border-0 text-xs rounded flex items-center h-6 px-1 pl-6 relative select-none">
More Tools
<RightSlot>
<ChevronRightIcon />
</RightSlot>
</DropdownMenu.SubTrigger>
<DropdownMenu.SubContent
sideOffset={2}
alignOffset={-5}
className="bg-white rounded p-1 shadow-lg"
>
<DropdownMenuItem>
Save Page As <RightSlot>+S</RightSlot>
</DropdownMenuItem>
<DropdownMenuItem>Create Shortcut</DropdownMenuItem>
<DropdownMenuItem>Name Window</DropdownMenuItem>
<Separator />
<DropdownMenuItem>Developer Tools</DropdownMenuItem>
</DropdownMenu.SubContent>
</DropdownMenu.Sub>
<Separator />
<DropdownMenuCheckboxItem
checked={bookmarksChecked}
onCheckedChange={setBookmarksChecked}
>
<DropdownMenuItemIndicator>
<CheckIcon />
</DropdownMenuItemIndicator>
Show Bookmarks <RightSlot>+B</RightSlot>
</DropdownMenuCheckboxItem>
<DropdownMenuCheckboxItem
checked={urlsChecked}
onCheckedChange={setUrlsChecked}
>
<DropdownMenuItemIndicator>
<CheckIcon />
</DropdownMenuItemIndicator>
Show Full URLs
</DropdownMenuCheckboxItem>
<Separator />
<DropdownMenu.Label className="pl-6 leading-6 text-xs text-gray-700">
Contributors
</DropdownMenu.Label>
<DropdownMenu.RadioGroup value={person} onValueChange={setPerson}>
<DropdownMenuRadioItem value="pedro">
<DropdownMenuItemIndicator>
<DotFilledIcon />
</DropdownMenuItemIndicator>
Pedro Sanchez
</DropdownMenuRadioItem>
<DropdownMenuRadioItem value="pablo">
<DropdownMenuItemIndicator>
<DotFilledIcon />
</DropdownMenuItemIndicator>
Pablo Sanchez
</DropdownMenuRadioItem>
</DropdownMenu.RadioGroup>
</DropdownMenu.Content>
</DropdownMenu.Root>
</div>
);
}