mirror of https://github.com/MaxLeiter/Drift
				
				
				
			client/server: clean-up admin page, re-implement user deletion/role toggling
							parent
							
								
									3d2bec0d5e
								
							
						
					
					
						commit
						be6de7c796
					
				@ -0,0 +1,43 @@
 | 
			
		||||
import { Popover, Button } from "@geist-ui/core"
 | 
			
		||||
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
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue