* Folds=>groups * Show groups on user profile * Allow group creation from /create * Refactoring to groups * Convert folds to groups * Add new add to group notification * Fix user profile tab bug * Add groups nav and tab for my groups * Remove bad profile pages * remove comments * Add group list dropdown to sidebar * remove unused * group cards ui * Messages=>Comments, v2, groupDetails * Discussion time * Cleaning up some code * Remove follow count * Fix pool scoring for cpmm * Fix imports * Simplify rules, add GroupUser collection * Fix group cards * Refactor * Refactor * Small fixes * Remove string * Add api error detail handling * Clear name field * Componentize * Spacing * Undo userpage memo * Member groups are already in my tab * Remove active contracts reference for now * Remove unused * Refactoring * Allow adding old questions to a group * Rename * Wording * Throw standard v2 APIError * Hide input for non-members, add about under title * Multiple names to & # more * Move comments firestore rules to appropriate subpaths * Group membership, pool=>volume * Cleanup, useEvent * Raise state to parent * Eliminate unused * Cleaning up * Clean code * Revert tags input deletion * Cleaning code * Stylling * Limit members to display * Array cleanup * Add categories back in * Private=>closed * Unused vars
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import React, { Fragment } from 'react'
 | |
| import { Menu, Transition } from '@headlessui/react'
 | |
| import clsx from 'clsx'
 | |
| 
 | |
| export type MenuItem = {
 | |
|   name: string
 | |
|   href: string
 | |
|   onClick?: () => void
 | |
| }
 | |
| 
 | |
| export function MenuButton(props: {
 | |
|   buttonContent: JSX.Element
 | |
|   menuItems: MenuItem[]
 | |
|   className?: string
 | |
| }) {
 | |
|   const { buttonContent, menuItems, className } = props
 | |
|   return (
 | |
|     <Menu
 | |
|       as="div"
 | |
|       className={clsx(className ? className : 'relative z-40 flex-shrink-0')}
 | |
|     >
 | |
|       <div>
 | |
|         <Menu.Button className="w-full rounded-full">
 | |
|           <span className="sr-only">Open user menu</span>
 | |
|           {buttonContent}
 | |
|         </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 left-0 mt-2 w-40 origin-top-right rounded-md bg-white py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
 | |
|           {menuItems.map((item) => (
 | |
|             <Menu.Item key={item.href}>
 | |
|               {({ active }) => (
 | |
|                 <a
 | |
|                   href={item.href}
 | |
|                   target={item.href.startsWith('http') ? '_blank' : undefined}
 | |
|                   onClick={item.onClick}
 | |
|                   className={clsx(
 | |
|                     active ? 'bg-gray-100' : '',
 | |
|                     'line-clamp-3 block py-1.5 px-4 text-sm text-gray-700'
 | |
|                   )}
 | |
|                 >
 | |
|                   {item.name}
 | |
|                 </a>
 | |
|               )}
 | |
|             </Menu.Item>
 | |
|           ))}
 | |
|         </Menu.Items>
 | |
|       </Transition>
 | |
|     </Menu>
 | |
|   )
 | |
| }
 |