Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove redundant tooltip on URL copy #3794

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import ContentCopyIcon from "@mui/icons-material/ContentCopy";
import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
import Link from "@mui/material/Link";
import Tooltip from "@mui/material/Tooltip";
import Typography from "@mui/material/Typography";
import { FlowStatus } from "@opensystemslab/planx-core/types";
import React, { useState } from "react";
Expand All @@ -11,27 +10,25 @@ import SettingsDescription from "ui/editor/SettingsDescription";
const CopyButton = (props: { link: string; isActive: boolean }) => {
const [copyMessage, setCopyMessage] = useState<"copy" | "copied">("copy");
return (
<Tooltip title={copyMessage}>
<Button
disabled={!props.isActive}
variant="help"
onMouseLeave={() => {
setTimeout(() => {
setCopyMessage("copy");
}, 500);
}}
onClick={() => {
setCopyMessage("copied");
navigator.clipboard.writeText(props.link);
}}
sx={{ marginLeft: 0.5 }}
>
<ContentCopyIcon style={{ width: "18px", height: "18px" }} />
<Typography ml={0.5} variant="body3">
{copyMessage}
</Typography>
</Button>
</Tooltip>
<Button
disabled={!props.isActive}
variant="help"
onMouseLeave={() => {
setTimeout(() => {
setCopyMessage("copy");
}, 500);
}}
onClick={() => {
setCopyMessage("copied");
navigator.clipboard.writeText(props.link);
}}
sx={{ marginLeft: 0.5 }}
>
<ContentCopyIcon style={{ width: "18px", height: "18px" }} />
<Typography ml={0.5} variant="body3">
{copyMessage}
</Typography>
</Button>
);
};

Expand Down
Loading