mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
fadeeaa59d
- Add aria-label to icon-only ActionIcon triggers across tree, comments, share, group, breadcrumbs, templates, AI chat, API keys, and spaces - Give custom clickable divs/spans (color swatches, status swatches, load-more, PDF error, comment selection) role="button", tabIndex, and keyboard handlers - Add listbox/combobox semantics (role, aria-selected, aria-activedescendant) to slash menu, emoji menu, mention list, and link editor results - Add aria-haspopup/aria-expanded to bubble-menu triggers (node, text align, color) and status badge - Add aria-label to Modal.Root/Dialog instances that lack a title prop (page history, template preview, trash preview, drawio, comment, find-and-replace, page verification) - Add en-US translations for new aria-label strings
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { ActionIcon, MantineColor, MantineSize, Tooltip } from "@mantine/core";
|
|
import { CopyButton } from "@/components/common/copy-button";
|
|
import { IconCheck, IconCopy } from "@tabler/icons-react";
|
|
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
interface CopyProps {
|
|
text: string;
|
|
size?: MantineSize;
|
|
color?: MantineColor;
|
|
}
|
|
export default function CopyTextButton({ text, size }: CopyProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<CopyButton value={text} timeout={2000}>
|
|
{({ copied, copy }) => (
|
|
<Tooltip
|
|
label={copied ? t("Copied") : t("Copy")}
|
|
withArrow
|
|
position="right"
|
|
>
|
|
<ActionIcon
|
|
color={copied ? "teal" : "gray"}
|
|
variant="subtle"
|
|
onClick={copy}
|
|
size={size}
|
|
aria-label={copied ? t("Copied") : t("Copy")}
|
|
>
|
|
{copied ? <IconCheck size={16} /> : <IconCopy size={16} />}
|
|
</ActionIcon>
|
|
</Tooltip>
|
|
)}
|
|
</CopyButton>
|
|
);
|
|
}
|