Improved dropdown to filter visits, adding support to filter out bots

This commit is contained in:
Alejandro Celaya
2021-06-22 20:34:28 +02:00
parent a0ab9533cb
commit 638ce89780
7 changed files with 151 additions and 110 deletions

View File

@@ -9,18 +9,20 @@ export interface DropdownBtnProps {
className?: string;
dropdownClassName?: string;
right?: boolean;
minWidth?: number;
}
export const DropdownBtn: FC<DropdownBtnProps> = (
{ text, disabled = false, className = '', children, dropdownClassName, right = false },
{ text, disabled = false, className = '', children, dropdownClassName, right = false, minWidth },
) => {
const [ isOpen, toggle ] = useToggle();
const toggleClasses = `dropdown-btn__toggle btn-block ${className}`;
const style = { minWidth: minWidth && `${minWidth}px` };
return (
<Dropdown isOpen={isOpen} toggle={toggle} disabled={disabled} className={dropdownClassName}>
<DropdownToggle caret className={toggleClasses} color="primary">{text}</DropdownToggle>
<DropdownMenu className="w-100" right={right}>{children}</DropdownMenu>
<DropdownMenu className="w-100" right={right} style={style}>{children}</DropdownMenu>
</Dropdown>
);
};