copy to clipboard

This commit is contained in:
Djeeberjr 2021-11-16 01:04:59 +01:00
parent c036d7d5ca
commit 7cc9fd7722
3 changed files with 19 additions and 4 deletions

View File

@ -9,6 +9,7 @@
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"autoprefixer": "^9",
"copy-to-clipboard": "^3.3.1",
"postcss": "^7",
"react": "^17.0.2",
"react-dom": "^17.0.2",

View File

@ -1,11 +1,10 @@
import React, { useState } from "react"
import copy from "copy-to-clipboard"
import RetakesConfig from "../types/RetakesConfig"
import AllDecks from "./AllDecks"
import MenuBar from "./MenuBar"
import Modal from "./Modal"
const App: React.FC = () => {
const [retakesConfig,setRetakesConfig] = useState(new RetakesConfig())
const [showExport,setShowExport] = useState(false)
@ -31,10 +30,13 @@ const App: React.FC = () => {
cols={50} rows={10}
value={exportText}
readOnly
className="text-black bg-transparent border-2 border-gray-900"
className="bg-transparent border-2 border-gray-900"
/>
</div>
<div className="bg-gray-700 button flex justify-center" >Copy to clipboard</div>
<div
className="bg-gray-700 button flex justify-center"
onClick={()=>copy(exportText)}
>Copy to clipboard</div>
</Modal>
</div>
)

View File

@ -3649,6 +3649,13 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
copy-to-clipboard@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae"
integrity sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==
dependencies:
toggle-selection "^1.0.6"
core-js-compat@^3.18.0, core-js-compat@^3.19.0, core-js-compat@^3.6.2:
version "3.19.1"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.19.1.tgz#fe598f1a9bf37310d77c3813968e9f7c7bb99476"
@ -10836,6 +10843,11 @@ to-regex@^3.0.1, to-regex@^3.0.2:
regex-not "^1.0.2"
safe-regex "^1.1.0"
toggle-selection@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32"
integrity sha1-bkWxJj8gF/oKzH2J14sVuL932jI=
toidentifier@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"