mirror of
https://github.com/outline/outline.git
synced 2026-11-21 13:34:02 +03:00
* base menu works * action internal link & group * action external link * simplify NewTemplatesMenu * animation * tiny cleanup * simplify group api * icon spacer * root action * mobile menu * decrease drawer animation speed * format * animation, const separator * memo.. * TemplatesMenu + Scrollable dropdown * delete file-ops * cap height
28 lines
873 B
TypeScript
28 lines
873 B
TypeScript
import { observer } from "mobx-react";
|
|
import { useMemo } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import ApiKey from "~/models/ApiKey";
|
|
import { DropdownMenu } from "~/components/Menu/DropdownMenu";
|
|
import { OverflowMenuButton } from "~/components/Menu/OverflowMenuButton";
|
|
import { revokeApiKeyFactory } from "~/actions/definitions/apiKeys";
|
|
import { useMenuAction } from "~/hooks/useMenuAction";
|
|
|
|
type Props = {
|
|
/** The apiKey to associate with the menu */
|
|
apiKey: ApiKey;
|
|
};
|
|
|
|
function ApiKeyMenu({ apiKey }: Props) {
|
|
const { t } = useTranslation();
|
|
const actions = useMemo(() => [revokeApiKeyFactory({ apiKey })], [apiKey]);
|
|
const rootAction = useMenuAction(actions);
|
|
|
|
return (
|
|
<DropdownMenu action={rootAction} ariaLabel={t("API key")}>
|
|
<OverflowMenuButton />
|
|
</DropdownMenu>
|
|
);
|
|
}
|
|
|
|
export default observer(ApiKeyMenu);
|