From 1feb095630b7ee217ef052dfaabafbb2fc32bd9e Mon Sep 17 00:00:00 2001 From: xtian7489 Date: Tue, 4 Jul 2023 07:31:22 -0300 Subject: [PATCH] agregando modal de confirmacion para convertirse en proyectistas --- ext/lib/site/banner-proyectistas/component.js | 36 +++++++++++++++- ext/lib/site/banner-proyectistas/styles.styl | 43 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/ext/lib/site/banner-proyectistas/component.js b/ext/lib/site/banner-proyectistas/component.js index 97852555..8d1be7e2 100644 --- a/ext/lib/site/banner-proyectistas/component.js +++ b/ext/lib/site/banner-proyectistas/component.js @@ -2,6 +2,9 @@ import React, { Component } from 'react' import { Link } from 'react-router' import userConnector from 'lib/site/connectors/user' import config from 'lib/config' +import NanoModal from 'nanomodal'; + +let modalRef = null class BannerProyectistas extends Component { constructor (props) { @@ -11,6 +14,37 @@ class BannerProyectistas extends Component { } } + componentDidMount() { + // Crea una instancia de NanoModal y asigna su referencia al ref del componente + modalRef = NanoModal("¿Querés inscribirte como proyectista?", { + classes: 'modalContent', + overlayClose: true, // Can't close the modal by clicking on the overlay. + buttons: [{ + text: "SI", + handler: (modal) => { + // do something... + this.onButtonPressed() + modal.hide(); + }, + classes: 'boton boton-primary', + }, { + text: "NO", + classes: 'boton boton-error', + handler: "hide" + }], + }); + modalRef.customShow = function (defaultShow, modalAPI) { + modalAPI.overlay.el.style.position = 'fixed' + modalAPI.overlay.el.style.display = 'block'; + modalAPI.modal.el.style.display = 'block'; + }; + } + + openModal = () => { + modalRef.customShow(modalRef.show, modalRef); + // Abre el modal cuando se hace clic en el botón + } + onButtonPressed = () => { // send a post to /api/settings/proyectistas/join using fetch let obj = {apa: 'apa'} @@ -71,7 +105,7 @@ class BannerProyectistas extends Component { } if (this.props.user.state.fulfilled && !this.props.user.state.value.proyectista && !buttonPressed) { return ( - + ) } })() diff --git a/ext/lib/site/banner-proyectistas/styles.styl b/ext/lib/site/banner-proyectistas/styles.styl index f2f130da..07290864 100644 --- a/ext/lib/site/banner-proyectistas/styles.styl +++ b/ext/lib/site/banner-proyectistas/styles.styl @@ -102,3 +102,46 @@ img width:25px; margin-right:10px; + + +.modalContent + position: fixed + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + padding:0; + width: 40%; + text-align: center; + margin: 0 + +.nanoModalContent + margin: 32px 56px; + + +.nanoModalButtons + display: flex!important; + justify-content: space-between; + +.boton + margin:24px; + border: none; + border-radius: 5px; + padding: 15px 30px; + display: inline-block; + margin-top: 10px; + margin-bottom: 10px; + font: inherit!important; +.boton-primary + color: #fff + box-shadow: 0px 4px 4px rgba(255,255,255,0.25), inset -6px -6px 10px rgba(140,3,117,0.5), inset 6px 6px 10px rgba(255,136,201,0.5) + background: #bf4588 + color: #fff + &:hover + color: #fff + background-color: #9c3b6e +.boton-error + background: #aaaaaa + color: #fff + &:hover + color: #fff + background-color: #898989