diff --git a/src/Components/AreasSubPages.js b/src/Components/AreasSubPages.js index 9af843fa3f83b5ee4e5a7616a0a0d0253f8cf4cd..62c00389ceddd3fb7c2f05688c82ff55d25f51fa 100644 --- a/src/Components/AreasSubPages.js +++ b/src/Components/AreasSubPages.js @@ -16,7 +16,7 @@ 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, { Component, useState } from "react"; +import React, { Component } from "react"; import axios from "axios"; import { apiUrl } from "../env"; import "./carousel.css"; @@ -32,6 +32,8 @@ import ResourceCardFunction from "./ResourceCardFunction.js"; import CollectionCardFunction from "./CollectionCardFunction.js"; import colecoes_obj from './FormationMaterialsResources/formationMaterials'; import ExpandedMaterial from './ExpandedMaterials'; +import Zoom from '@material-ui/core/Zoom'; + const materials = colecoes_obj(); @@ -271,14 +273,20 @@ class SubPages extends Component { case "Materiais": const HandleExpandMaterial = (id) => { - console.log(id); - this.setState({ - currMaterial: { - open: !this.state.currMaterial.open, - material: { ...materials[id] } - } - }) - console.log(this.state.currMaterial) + if (id !== this.state.currMaterial.material.id) + this.setState({ + currMaterial: { + open: true, + material: { ...materials[id] } + } + }) + else + this.setState({ + currMaterial: { + open: false, + material: {} + } + }) } @@ -345,7 +353,7 @@ class SubPages extends Component { </Carousel> { this.state.currMaterial.open ? - <ExpandedMaterial material={this.state.currMaterial.material}/> + <ExpandedMaterial material={this.state.currMaterial.material} /> : null }