mirror of https://github.com/MaxLeiter/Drift
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			39 lines
		
	
	
		
			706 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			39 lines
		
	
	
		
			706 B
		
	
	
	
		
			TypeScript
		
	
import { Popover, Button } from "@geist-ui/core/dist"
 | 
						|
import { MoreVertical } from "@geist-ui/icons"
 | 
						|
 | 
						|
type Action = {
 | 
						|
	title: string
 | 
						|
	onClick: () => void
 | 
						|
}
 | 
						|
 | 
						|
const ActionDropdown = ({
 | 
						|
	title = "Actions",
 | 
						|
	actions,
 | 
						|
	showTitle = false
 | 
						|
}: {
 | 
						|
	title?: string
 | 
						|
	showTitle?: boolean
 | 
						|
	actions: Action[]
 | 
						|
}) => {
 | 
						|
	return (
 | 
						|
		<Popover
 | 
						|
			title={title}
 | 
						|
			content={
 | 
						|
				<>
 | 
						|
					{showTitle && <Popover.Item title>{title}</Popover.Item>}
 | 
						|
					{actions.map((action) => (
 | 
						|
						<Popover.Item onClick={action.onClick} key={action.title}>
 | 
						|
							{action.title}
 | 
						|
						</Popover.Item>
 | 
						|
					))}
 | 
						|
				</>
 | 
						|
			}
 | 
						|
			hideArrow
 | 
						|
		>
 | 
						|
			<Button iconRight={<MoreVertical />} auto></Button>
 | 
						|
		</Popover>
 | 
						|
	)
 | 
						|
}
 | 
						|
 | 
						|
export default ActionDropdown
 |