Skip to content
Snippets Groups Projects
CriarColecaoModal.js 4.06 KiB
Newer Older
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
/*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 from 'react'
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
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 CriarColecaoForm from './CriarColecaoForm.js'
import CloseIcon from '@material-ui/icons/Close';

lfr20's avatar
lfr20 committed
function CloseModalButton(props) {
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
    return (
        <StyledCloseModalButton onClick={props.handleClose}>
lfr20's avatar
lfr20 committed
            <CloseIcon style={props.contrast === "" ? { color: "#666" } : { color: "white" }} />
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
        </StyledCloseModalButton>
    )
}

lfr20's avatar
lfr20 committed
export default function CriarColecaoModal(props) {
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed

    return (
        <StyledModal
            aria-labelledby="transition-modal-title"
            aria-describedby="transition-modal-description"
            open={props.open}
            centered="true"
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
            onClose={props.handleClose}
            closeAfterTransition
            BackdropComponent={Backdrop}
            BackdropProps={{
                timeout: 500,
            }}
        >
            <Fade in={props.open}>
lfr20's avatar
lfr20 committed
                <Container contrast={props.contrast}>
                    <Header contrast={props.contrast}>
                        <span style={{ width: "32px" }} />
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
                        <h2>Criar Coleção</h2>
lfr20's avatar
lfr20 committed
                        <CloseModalButton handleClose={props.handleClose} contrast={props.contrast} />
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
                    </Header>
lfr20's avatar
lfr20 committed
                    <Content style={{ paddingTop: "0" }}>
                        <CriarColecaoForm handleClose={props.handleClose} finalize={props.handleClose} />
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
                    </Content>
                </Container>
            </Fade>
        </StyledModal>
    )
}

const Content = styled.div`
    padding : 20px 30px;
    overflow-y: 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;
lfr20's avatar
lfr20 committed
        color: ${props => props.contrast === "" ? "#666" : "white"};
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
    }
`

const StyledCloseModalButton = styled(Button)`
    display : inline-block;
    position : relative;
    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);
lfr20's avatar
lfr20 committed
    background-color: ${props => props.contrast === "" ? "white" : "black"};
    border: ${props => props.contrast === "" ? "" : "1px solid white"};
lfr20's avatar
lfr20 committed
    align-items : center;
Lucas Eduardo Schoenfelder's avatar
Lucas Eduardo Schoenfelder committed
    display : flex;
    flex-direction : column;
    min-width : 240px;
    max-height : none;
    position : relative;
    padding : 10px;
    border-radius : 4px;

    @media screen and (min-width : 96px) {
        width : 500px;
    }

    @media screen and (max-width : 699px) {
        width : 100%;
        height : 100%;
    }
`