Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
MAC_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이정민
2021-05-27 13:46:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3d4b4a2fc8bbd479e43ffca8732c19b85eed9e91
3d4b4a2f
1 parent
60a672d5
copied alert
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletions
src/components/GifEditor.tsx
src/components/GifEditor.tsx
View file @
3d4b4a2
...
...
@@ -90,8 +90,11 @@ const GifEditor = ({ previewURL }) => {
setDownload(null);
setPercent(0);
setViewLink(null);
setIsCopied(false);
};
// 클립보드 관련
const [isCopied, setIsCopied] = useState(false);
const clipboardCopy = (text: string) => {
if (!document.queryCommandSupported("copy")) {
return alert("클립보드가 지원되지 않는 브라우저입니다.");
...
...
@@ -108,6 +111,13 @@ const GifEditor = ({ previewURL }) => {
return null;
};
const handleShare = (text) => {
setIsCopied(true);
clipboardCopy(text);
setTimeout(() => {
setIsCopied(false);
}, 2000);
};
return (
<>
...
...
@@ -133,7 +143,7 @@ const GifEditor = ({ previewURL }) => {
<div className="download__explain">Click to Copy the Link!</div>
<div
className="download__copy"
onClick={() =>
clipboardCopy
(viewLink)}
onClick={() =>
handleShare
(viewLink)}
>
{viewLink}
<div style={{ marginLeft: "0.5rem" }}>
...
...
@@ -141,6 +151,7 @@ const GifEditor = ({ previewURL }) => {
</div>
</div>
</div>
<CopiedText {...{ isCopied }}>Copied to Clipboard!</CopiedText>
</div>
</>
)}
...
...
@@ -361,4 +372,18 @@ const ModalWrapper = styled.div<{ unableToUpload: boolean }>`
}
`;
const CopiedText = styled.div<{ isCopied: boolean }>`
position: absolute;
z-index: 100;
top: 35rem;
font-size: 1.2rem;
background: white;
padding: 0.7rem 1rem;
white-space: nowrap;
border-radius: 2rem;
transition: 0.3s;
opacity: ${({ isCopied }) => (isCopied ? 1 : 0)};
box-shadow: ${({ theme }) => theme.boxShadow.normal};
`;
export default GifEditor;
...
...
Please
register
or
login
to post a comment