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

adding message when pressing the "copy to editor" button #153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions frontend/src/components/frame/Frame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Frame = ({
const dispatch = useDispatch();
const [isFullScreen, setFullScreen] = useState(false);
const [isExpand, setExpand] = useState(true);

const [showCopyPopup, setShowCopyPopup] = useState(false);
// const downloadMenu = () => (
// <Menu onClick={(e) => onDownload(e)}>
// <Menu.Item key="png">
Expand All @@ -69,6 +69,14 @@ const Frame = ({
// </Menu>
// );

const handleOnClickCopyToEditor = () => {
setShowCopyPopup(true);
setTimeout(() => {
setShowCopyPopup(false);
}, 2000);
dispatch(setCommand(reqString));
};

return (
<div className={`${styles.Frame} ${isFullScreen ? styles.FullScreen : ''}`}>
<div className={styles.FrameHeader}>
Expand All @@ -82,11 +90,12 @@ const Frame = ({
title="copy to editor"
icon={faClone}
size="s"
onClick={() => dispatch(setCommand(reqString))}
onClick={handleOnClickCopyToEditor}
style={{
cursor: 'pointer',
}}
/>
{showCopyPopup && <div>Copied to editor</div>}
</div>
<div className={styles.ButtonArea}>
{!isTable && onThick ? (
Expand Down