From 577b8c99d2ffb911990e04469c96d163961676ce Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 31 Aug 2020 15:54:15 -0400 Subject: [PATCH 1/6] new copy button --- src/content/UserPage/UserPage.js | 20 ++++++++++++++++++++ src/content/UserPage/user-page.scss | 12 +++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/content/UserPage/UserPage.js b/src/content/UserPage/UserPage.js index 5fc5811..3547bc2 100644 --- a/src/content/UserPage/UserPage.js +++ b/src/content/UserPage/UserPage.js @@ -7,6 +7,8 @@ const UserPage = () => { const [inputTextValue, inputTextSetValue] = React.useState('') const [outputTextValue, outputTextSetValue] = React.useState('') const [loading, loadingSetValue] = React.useState('') + const [copyButton, setCopyButton] = React.useState('') + const [copySuccess, setCopySuccess] = React.useState('') const inputTextOnChange = e => { inputTextSetValue(e.target.value) @@ -43,12 +45,21 @@ const UserPage = () => { xhr.send(inputTextValue) loadingSetValue(true) } + setCopyButton(true) } const cleanText = () => { inputTextSetValue('') } + const textAreaRef = React.useRef(null) + function copyToClipboard (e) { + textAreaRef.current.select() + document.execCommand('copy') + e.target.focus() + setCopySuccess('Copied!') + }; + return (
{loading ? : null} @@ -115,11 +126,20 @@ const UserPage = () => { rows={20} className='user-page-text-area-second' placeholder='Texto revisado' + ref={textAreaRef} />
+ {copyButton + ? : null}
A revisão não está correta? diff --git a/src/content/UserPage/user-page.scss b/src/content/UserPage/user-page.scss index bb5b3ca..9bd2b81 100644 --- a/src/content/UserPage/user-page.scss +++ b/src/content/UserPage/user-page.scss @@ -51,6 +51,16 @@ $icon-color-hover: $carbon--blue-50; float: left; } +.bx--col-lg-5 { + position: relative; +} + +.bx--col-lg-5 .copy-Button-2 { + position: absolute; + top: 1 + 0.6875rem; + right: 1rem; +} + .click-here{ float: right; margin-top: 1rem; @@ -86,7 +96,7 @@ svg.user-page-arrow{ left: calc(50% - 16px); } -// MODAL +// MODAL .bx--modal-container { position: absolute; From 982e35d00e9ad994718bf43523aaae5a541e4db0 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 3 Sep 2020 17:47:34 -0400 Subject: [PATCH 2/6] single button --- src/content/UserPage/UserPage.js | 17 ++++++----------- src/content/UserPage/user-page.scss | 14 +++++--------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/content/UserPage/UserPage.js b/src/content/UserPage/UserPage.js index 3547bc2..570170e 100644 --- a/src/content/UserPage/UserPage.js +++ b/src/content/UserPage/UserPage.js @@ -8,7 +8,7 @@ const UserPage = () => { const [outputTextValue, outputTextSetValue] = React.useState('') const [loading, loadingSetValue] = React.useState('') const [copyButton, setCopyButton] = React.useState('') - const [copySuccess, setCopySuccess] = React.useState('') + const textAreaRef = React.useRef(null) const inputTextOnChange = e => { inputTextSetValue(e.target.value) @@ -52,12 +52,10 @@ const UserPage = () => { inputTextSetValue('') } - const textAreaRef = React.useRef(null) - function copyToClipboard (e) { + function handleCopy (e) { textAreaRef.current.select() document.execCommand('copy') e.target.focus() - setCopySuccess('Copied!') }; return ( @@ -73,7 +71,7 @@ const UserPage = () => { @@ -129,16 +127,13 @@ const UserPage = () => { ref={textAreaRef} />
- {copyButton ? : null}
diff --git a/src/content/UserPage/user-page.scss b/src/content/UserPage/user-page.scss index 9bd2b81..321c50f 100644 --- a/src/content/UserPage/user-page.scss +++ b/src/content/UserPage/user-page.scss @@ -45,19 +45,15 @@ $icon-color-hover: $carbon--blue-50; float: right; } -.copy-Button{ - background: $clean-review-button-color; - color: $textarea-font-color; - float: left; -} - .bx--col-lg-5 { position: relative; } -.bx--col-lg-5 .copy-Button-2 { +.copy-Button{ + background: $clean-review-button-color; + color: $textarea-font-color; position: absolute; - top: 1 + 0.6875rem; + top: 1.6875rem; right: 1rem; } @@ -96,7 +92,7 @@ svg.user-page-arrow{ left: calc(50% - 16px); } -// MODAL +// MODAL .bx--modal-container { position: absolute; From 70fd8aa02cf2023ca909409820b04f59f3777cbb Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 5 Sep 2020 08:20:39 -0400 Subject: [PATCH 3/6] singke button --- src/content/UserPage/UserPage.js | 2 +- src/content/UserPage/user-page.scss | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/content/UserPage/UserPage.js b/src/content/UserPage/UserPage.js index 570170e..e168d20 100644 --- a/src/content/UserPage/UserPage.js +++ b/src/content/UserPage/UserPage.js @@ -52,7 +52,7 @@ const UserPage = () => { inputTextSetValue('') } - function handleCopy (e) { + const handleCopy = e => { textAreaRef.current.select() document.execCommand('copy') e.target.focus() diff --git a/src/content/UserPage/user-page.scss b/src/content/UserPage/user-page.scss index 321c50f..71ff86a 100644 --- a/src/content/UserPage/user-page.scss +++ b/src/content/UserPage/user-page.scss @@ -45,16 +45,10 @@ $icon-color-hover: $carbon--blue-50; float: right; } -.bx--col-lg-5 { - position: relative; -} - .copy-Button{ background: $clean-review-button-color; color: $textarea-font-color; - position: absolute; - top: 1.6875rem; - right: 1rem; + float: left; } .click-here{ @@ -155,4 +149,4 @@ svg.user-page-arrow{ &:active { background-color: transparent; } -} +} \ No newline at end of file From cba451630d988a52927ce9a27eec26163c34dd44 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 5 Sep 2020 08:20:39 -0400 Subject: [PATCH 4/6] single button --- src/content/UserPage/UserPage.js | 2 +- src/content/UserPage/user-page.scss | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/content/UserPage/UserPage.js b/src/content/UserPage/UserPage.js index 570170e..e168d20 100644 --- a/src/content/UserPage/UserPage.js +++ b/src/content/UserPage/UserPage.js @@ -52,7 +52,7 @@ const UserPage = () => { inputTextSetValue('') } - function handleCopy (e) { + const handleCopy = e => { textAreaRef.current.select() document.execCommand('copy') e.target.focus() diff --git a/src/content/UserPage/user-page.scss b/src/content/UserPage/user-page.scss index 321c50f..71ff86a 100644 --- a/src/content/UserPage/user-page.scss +++ b/src/content/UserPage/user-page.scss @@ -45,16 +45,10 @@ $icon-color-hover: $carbon--blue-50; float: right; } -.bx--col-lg-5 { - position: relative; -} - .copy-Button{ background: $clean-review-button-color; color: $textarea-font-color; - position: absolute; - top: 1.6875rem; - right: 1rem; + float: left; } .click-here{ @@ -155,4 +149,4 @@ svg.user-page-arrow{ &:active { background-color: transparent; } -} +} \ No newline at end of file From 2ec56b57fc54244d9a9746db9d25900b173db5eb Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 5 Sep 2020 08:29:23 -0400 Subject: [PATCH 5/6] single button --- src/content/UserPage/UserPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/UserPage/UserPage.js b/src/content/UserPage/UserPage.js index e168d20..39dc615 100644 --- a/src/content/UserPage/UserPage.js +++ b/src/content/UserPage/UserPage.js @@ -56,7 +56,7 @@ const UserPage = () => { textAreaRef.current.select() document.execCommand('copy') e.target.focus() - }; + } return (
From 088f7663adcf2cf0295b4c02418315e86ec4ceb2 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 5 Sep 2020 08:38:08 -0400 Subject: [PATCH 6/6] single button --- src/content/UserPage/UserPage.js | 2 +- src/content/UserPage/user-page.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/UserPage/UserPage.js b/src/content/UserPage/UserPage.js index 39dc615..5b15439 100644 --- a/src/content/UserPage/UserPage.js +++ b/src/content/UserPage/UserPage.js @@ -71,7 +71,7 @@ const UserPage = () => { diff --git a/src/content/UserPage/user-page.scss b/src/content/UserPage/user-page.scss index 71ff86a..bb5b3ca 100644 --- a/src/content/UserPage/user-page.scss +++ b/src/content/UserPage/user-page.scss @@ -149,4 +149,4 @@ svg.user-page-arrow{ &:active { background-color: transparent; } -} \ No newline at end of file +}