Skip to content
Snippets Groups Projects
Commit fc60ddbc authored by Ganapathi Subramanyam  Jayam's avatar Ganapathi Subramanyam Jayam 🎯
Browse files

minor changes and added copy to clipboard to shareable link

parent 971464b7
No related branches found
No related tags found
1 merge request!39Shareablelink #39
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"firebaseui": "^4.7.3", "firebaseui": "^4.7.3",
"react": "^17.0.1", "react": "^17.0.1",
"react-bootstrap": "^1.5.0", "react-bootstrap": "^1.5.0",
"react-copy-to-clipboard": "^5.0.3",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-github-login-button": "^1.0.1", "react-github-login-button": "^1.0.1",
"react-google-button": "^0.7.2", "react-google-button": "^0.7.2",
......
...@@ -14,7 +14,6 @@ import Loader from 'react-loader-spinner' ...@@ -14,7 +14,6 @@ import Loader from 'react-loader-spinner'
const Hero = ({ handleLogout }) => { const Hero = ({ handleLogout }) => {
const { folderId } = useParams() const { folderId } = useParams()
const { folder, childFolders } = useFolder(folderId) const { folder, childFolders } = useFolder(folderId)
console.log(folder);
if (!folder) { if (!folder) {
return ( return (
......
import { React , useState } from "react"; import { React, useState } from 'react'
import { Button,Modal,Form} from 'react-bootstrap'; import { Button, Modal, Form } from 'react-bootstrap'
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faLink } from "@fortawesome/free-solid-svg-icons"; import { faLink,faPaste } from '@fortawesome/free-solid-svg-icons'
import { CopyToClipboard } from 'react-copy-to-clipboard'
export default function Sharelink({ currentFolder }) { export default function Sharelink({ currentFolder }) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false)
const [clipBoard, setClipBoard] = useState(false)
function openModal() { function openModal() {
setOpen(true); setOpen(true)
} }
function closeModal() { function closeModal() {
setOpen(false); setOpen(false)
} }
return ( return (
<> <>
<Button style={{maxWidth : "80px" }} onClick={openModal} className="mr-2" variant="primary" size="sm" > <Button
style={{ maxWidth: '80px' }}
onClick={openModal}
className='mr-2'
variant='primary'
size='sm'
>
<FontAwesomeIcon icon={faLink} /> <FontAwesomeIcon icon={faLink} />
</Button> </Button>
<Modal show={open} onHide={closeModal}> <Modal show={open} onHide={closeModal}>
<Modal.Body> <Modal.Body>
{/* text area that will display link */} <Form.Group>
<p>Sharable link for this folder : </p> <Form.Label>Sharable link for this folder :</Form.Label>
<textarea rows="2" cols="55" utofocus readOnly value={"www.dcfstudentview.com/"+String(currentFolder.id)}> <Form.Label>
</textarea> {'www.dcfstudentview.com/' + String(currentFolder.id)}
<p></p>
<CopyToClipboard
text={'www.dcfstudentview.com/' + String(currentFolder.id)}
onCopy={() =>setClipBoard(true)}
>
<FontAwesomeIcon icon={faPaste} />
</CopyToClipboard>
{clipBoard ? <span style={{color: 'red'}}>Copied.</span> : null}
</Form.Label>
</Form.Group>
</Modal.Body> </Modal.Body>
<Modal.Footer> <Modal.Footer>
<Button variant="danger" onClick={closeModal}> <Button variant='danger' onClick={closeModal}>
Close Close
</Button> </Button>
</Modal.Footer> </Modal.Footer>
</Modal> </Modal>
</> </>
); )
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment