keycloak-scim/libs/keycloak-masthead/src/KeycloakDropdown.tsx
Erik Jan de Wit b7e4db8e15
Add 'Personal Info' form and masthead to Account UI (#3551)
Co-authored-by: Jon Koops <jonkoops@gmail.com>
2022-11-03 15:06:26 +01:00

32 lines
722 B
TypeScript

import { ReactNode, useState } from "react";
import { Dropdown, DropdownToggle, KebabToggle } from "@patternfly/react-core";
type KeycloakDropdownProps = {
isKebab?: boolean;
title?: ReactNode;
dropDownItems: ReactNode[];
};
export const KeycloakDropdown = ({
isKebab = false,
title,
dropDownItems,
}: KeycloakDropdownProps) => {
const [open, setOpen] = useState(false);
return (
<Dropdown
isPlain
position="right"
toggle={
isKebab ? (
<KebabToggle onToggle={setOpen}>{title}</KebabToggle>
) : (
<DropdownToggle onToggle={setOpen}>{title}</DropdownToggle>
)
}
isOpen={open}
dropdownItems={dropDownItems}
/>
);
};