From 7a04c95bd292818c349685d78629ca4082d96e82 Mon Sep 17 00:00:00 2001
From: Lucas Schoenfelder <les17@inf.ufpr.br>
Date: Fri, 22 May 2020 13:32:40 -0300
Subject: [PATCH] wip; missing button functionalities

---
 src/Components/ShareModal.js | 240 +++++++++++++++++++++++++++++++++++
 1 file changed, 240 insertions(+)
 create mode 100644 src/Components/ShareModal.js

diff --git a/src/Components/ShareModal.js b/src/Components/ShareModal.js
new file mode 100644
index 00000000..15f23349
--- /dev/null
+++ b/src/Components/ShareModal.js
@@ -0,0 +1,240 @@
+/*Copyright (C) 2019 Centro de Computacao Cientifica e Software Livre
+Departamento de Informatica - Universidade Federal do Parana
+
+This file is part of Plataforma Integrada MEC.
+
+Plataforma Integrada MEC is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Plataforma Integrada MEC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
+
+import React, {useContext, useRef} from 'react';
+import { Button } from '@material-ui/core';
+import Modal from '@material-ui/core/Modal';
+import Backdrop from '@material-ui/core/Backdrop';
+import Fade from '@material-ui/core/Fade';
+import styled from 'styled-components'
+import SignUpContainer from './SignUpContainerFunction.js'
+import {Store} from '../Store.js'
+import axios from 'axios'
+import {apiDomain} from '../env';
+import CloseIcon from '@material-ui/icons/Close';
+import Grid from '@material-ui/core/Grid';
+import Facebook from '../img/facebook.svg'
+import Twitter from '../img/twitter.svg'
+import LinkIcon from '../img/link_icon.svg'
+
+
+function CloseModalButton (props) {
+    return (
+        <StyledCloseModalButton onClick={props.handleClose}>
+            <CloseIcon/>
+        </StyledCloseModalButton>
+    )
+}
+
+export default function ReportModal (props) {
+        const pRef = useRef(props.link);
+
+      function copyToClipboard(e) {
+          console.log(pRef.current)
+        pRef.current.select();
+        document.execCommand('copy');
+        // This is just personal preference.
+        // I prefer to not show the the whole text area selected.
+        e.target.focus();
+      };
+
+    return (
+        <StyledModal
+            aria-labelledby="transition-modal-title"
+            aria-describedby="transition-modal-description"
+            open={props.open}
+            animation={true}
+            centered={true}
+            onClose={props.handleClose}
+            closeAfterTransition
+            BackdropComponent={Backdrop}
+            BackdropProps={{
+                timeout: 500,
+            }}
+        >
+            <Fade in={props.open}>
+                <Container>
+                    <Header>
+                        <span style={{width:"32px"}}/>
+                        <h2>Compartilhar este recurso</h2>
+                        <CloseModalButton handleClose={props.handleClose}/>
+                    </Header>
+                    <Content style={{paddingTop : "0"}}>
+                        <ResourceInfo>
+                            <img src={apiDomain + props.thumb} alt="thumbnail recurso"/>
+                            <div className="text">
+                                <strong>{props.title}</strong>
+                                <span>{props.link}</span>
+                            </div>
+                        </ResourceInfo>
+                        <ShareInfo>
+                        <Grid container style={{paddingRight : "15px", paddingLeft : "15px"}}>
+                            <Grid item xs={4}>
+                                <Button>
+                                    <img src={Facebook} alt="facebook-logo"/>
+                                    <p>FACEBOOK</p>
+                                </Button>
+                            </Grid>
+                            <Grid item xs={4}>
+                                <Button>
+                                    <img src={Twitter} alt="twitter-logo"/>
+                                    <p>TWITTER</p>
+                                </Button>
+                            </Grid>
+                            <Grid item xs={4}>
+                                <Button onClick={copyToClipboard}>
+                                    <img src={LinkIcon} alt="link-icon"/>
+                                    <p ref={pRef} value={props.link}>COPIAR LINK</p>
+                                </Button>
+                            </Grid>
+                        </Grid>
+                        </ShareInfo>
+                    </Content>
+                </Container>
+            </Fade>
+        </StyledModal>
+    )
+}
+
+const ShareButton = styled(Button)`
+    text-align :center;
+    margin : 0 !important;
+    min-height : 121px !important;
+
+    img {
+        height : 75px;
+        width : 75px;
+        padding-top : 10px;
+        vertical-align : middle;
+    }
+
+    p {
+        margin : 0 0 10px;
+    }
+`
+
+const ShareInfo = styled.div`
+    padding-top : 20px;
+    color : #000;
+`
+
+const ResourceInfo = styled.div`
+    margin-top : 0;
+    background-color : #f4f4f4;
+    overflow : hidden;
+    border-radius : 5px;
+    display : flex;
+    flex-direction : row;
+    align-items : center;
+    align-content : center;
+    max-wdith : 100%;
+    justify-content : space-between;
+
+    .text {
+        max-height : 100%;
+        max-width : 66.66%;
+        display : flex;
+        flex-direction : column;
+        text-align : left;
+    }
+
+    img {
+        object-fit : cover;
+        height : 115px;
+        max-width : 165px;
+        background-color : #e5e5e5;
+        float : left;
+        padding : 0;
+
+        @media screen and (min-width : 600px) {
+            margin-right : 20px;
+            margin-bottom : 0;
+        }
+        @media screen and (max-width : 768px) {
+            width : 100%;
+        }
+    }
+
+`
+
+const Content = styled.div`
+    padding : 20px 30px;
+    overflow : visible;
+
+`
+
+const Header = styled.div`
+    display : flex;
+    flex-direction : row;
+    padding : 10px 26px 0 26px;
+    align-items : center;
+    justify-content : space-between;
+    height : 64px;
+
+    h2 {
+        font-size : 26px;
+        font-weight : lighter;
+        color : #666
+    }
+`
+
+const StyledCloseModalButton = styled(Button)`
+    display : inline-block;
+    position : relative;
+    float : right !important;
+    margin-right : -8px !important;
+    background : transparent !important;
+    min-width: 0 !important;
+    width : 40px;
+`
+
+const StyledModal = styled(Modal)`
+    .djXaxP{
+        margin : 0 !important;
+    }
+    display : flex;
+    align-items: center;
+    justify-content : center;
+    text-align : center;
+    padding : 10px !important;
+    max-width : none;
+    max-height : none;
+`
+
+const Container = styled.div`
+    box-sizing : border-box;
+    box-shadow : 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12);
+    background-color : white;
+    align : center;
+    display : flex;
+    flex-direction : column;
+    min-width : 240px;
+    max-height : none;
+    position : relative;
+    padding : 10px;
+    border-radius : 4px;
+
+    @media screen and (min-width : 700px) {
+        max-width : 600px;
+    }
+
+    @media screen and (max-width : 699px) {
+        width : 100%;
+        height : 100%;
+    }
+`
-- 
GitLab