This repository has been archived on 2024-04-04. You can view files and clone it, but cannot push or open issues or pull requests.
tailwindui/react/components/application-ui/headings/section-headings/with_badge_and_dropdown.jsx

91 lines
3.6 KiB
React
Raw Normal View History

2024-01-24 19:02:44 +08:00
import { Fragment } from 'react'
import { Menu, Transition } from '@headlessui/react'
import { EllipsisVerticalIcon } from '@heroicons/react/20/solid'
function classNames(...classes) {
return classes.filter(Boolean).join(' ')
}
export default function Example() {
return (
<div className="border-b border-gray-200 pb-5">
<div className="sm:flex sm:items-baseline sm:justify-between">
<div className="sm:w-0 sm:flex-1">
<h1 id="message-heading" className="text-base font-semibold leading-6 text-gray-900">
Full-Stack Developer
</h1>
<p className="mt-1 truncate text-sm text-gray-500">Checkout and Payments Team</p>
</div>
<div className="mt-4 flex items-center justify-between sm:ml-6 sm:mt-0 sm:flex-shrink-0 sm:justify-start">
<span className="inline-flex items-center rounded-full bg-green-50 px-2 py-1 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20">
Open
</span>
<Menu as="div" className="relative ml-3 inline-block text-left">
<div>
<Menu.Button className="-my-2 flex items-center rounded-full bg-white p-2 text-gray-400 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-indigo-500">
<span className="sr-only">Open options</span>
<EllipsisVerticalIcon className="h-5 w-5" aria-hidden="true" />
</Menu.Button>
</div>
<Transition
as={Fragment}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
leave="transition ease-in duration-75"
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items className="absolute right-0 z-10 mt-2 w-56 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
<div className="py-1">
<Menu.Item>
{({ active }) => (
<a
href="#"
className={classNames(
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
'flex justify-between px-4 py-2 text-sm'
)}
>
<span>Edit</span>
</a>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<a
href="#"
className={classNames(
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
'flex justify-between px-4 py-2 text-sm'
)}
>
<span>Duplicate</span>
</a>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<button
type="button"
className={classNames(
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
'flex w-full justify-between px-4 py-2 text-sm'
)}
>
<span>Archive</span>
</button>
)}
</Menu.Item>
</div>
</Menu.Items>
</Transition>
</Menu>
</div>
</div>
</div>
)
}