mirror of
https://github.com/outline/outline.git
synced 2026-11-24 23:00:18 +03:00
* collection group member menu * comment menu * group member menu * group menu; added support for disabled items * insights menu * member menu * notifications menu * share menu * alignment * tsc, graphite feedback * remove unused `CollectionGroupMenu` & `MemberMenu`
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { observer } from "mobx-react";
|
|
import * as React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import Share from "~/models/Share";
|
|
import { DropdownMenu } from "~/components/Menu/DropdownMenu";
|
|
import { OverflowMenuButton } from "~/components/Menu/OverflowMenuButton";
|
|
import usePolicy from "~/hooks/usePolicy";
|
|
import { ActionV2Separator } from "~/actions";
|
|
import {
|
|
copyShareUrlFactory,
|
|
goToShareSourceFactory,
|
|
revokeShareFactory,
|
|
} from "~/actions/definitions/shares";
|
|
import { useMenuAction } from "~/hooks/useMenuAction";
|
|
|
|
type Props = {
|
|
share: Share;
|
|
};
|
|
|
|
function ShareMenu({ share }: Props) {
|
|
const { t } = useTranslation();
|
|
const can = usePolicy(share);
|
|
|
|
const actions = React.useMemo(
|
|
() => [
|
|
copyShareUrlFactory({ share }),
|
|
goToShareSourceFactory({ share }),
|
|
ActionV2Separator,
|
|
revokeShareFactory({ share, can }),
|
|
],
|
|
[share, can]
|
|
);
|
|
|
|
const rootAction = useMenuAction(actions);
|
|
|
|
return (
|
|
<DropdownMenu
|
|
action={rootAction}
|
|
align="end"
|
|
ariaLabel={t("Share options")}
|
|
>
|
|
<OverflowMenuButton />
|
|
</DropdownMenu>
|
|
);
|
|
}
|
|
|
|
export default observer(ShareMenu);
|