feat: Add 'Rename…' option to collection menu

This commit is contained in:
Tom Moor
2024-02-03 16:53:39 -05:00
parent 176a0451fc
commit ca7d919b94
4 changed files with 21 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import {
ExportIcon,
AlphabeticalSortIcon,
ManualSortIcon,
InputIcon,
} from "outline-icons";
import * as React from "react";
import { useTranslation } from "react-i18next";
@@ -38,6 +39,7 @@ type Props = {
placement?: Placement;
modal?: boolean;
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
onRename?: () => void;
onOpen?: () => void;
onClose?: () => void;
};
@@ -47,6 +49,7 @@ function CollectionMenu({
label,
modal = true,
placement,
onRename,
onOpen,
onClose,
}: Props) {
@@ -166,6 +169,13 @@ function CollectionMenu({
{
type: "separator",
},
{
type: "button",
title: `${t("Rename")}`,
visible: !!can.update && !!onRename,
onClick: () => onRename?.(),
icon: <InputIcon />,
},
actionToMenuItem(editCollection, context),
actionToMenuItem(editCollectionPermissions, context),
{