From 51255d18c8ccea67a91162eb6539beaed318d190 Mon Sep 17 00:00:00 2001 From: Guillaume Viger Date: Mon, 29 Apr 2024 15:04:27 -0400 Subject: [PATCH] header-ui: [#855] add inert request membership button+modal --- .../header/RequestMembershipButton.js | 104 ++++++++++++++++++ .../community/header/index.js | 21 ++++ .../invenio_communities/details/base.html | 5 + .../invenio_communities/details/header.html | 19 +++- invenio_communities/views/communities.py | 1 + invenio_communities/webpack.py | 1 + 6 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 invenio_communities/assets/semantic-ui/js/invenio_communities/community/header/RequestMembershipButton.js create mode 100644 invenio_communities/assets/semantic-ui/js/invenio_communities/community/header/index.js diff --git a/invenio_communities/assets/semantic-ui/js/invenio_communities/community/header/RequestMembershipButton.js b/invenio_communities/assets/semantic-ui/js/invenio_communities/community/header/RequestMembershipButton.js new file mode 100644 index 000000000..42c85e39f --- /dev/null +++ b/invenio_communities/assets/semantic-ui/js/invenio_communities/community/header/RequestMembershipButton.js @@ -0,0 +1,104 @@ +/* + * This file is part of Invenio. + * Copyright (C) 2024 CERN. + * Copyright (C) 2024 Northwestern University. + * + * Invenio is free software; you can redistribute it and/or modify it + * under the terms of the MIT License; see LICENSE file for more details. + */ + +import { i18next } from "@translations/invenio_communities/i18next"; +import { Formik } from "formik"; +import PropTypes from "prop-types"; +import React, { useState } from "react"; +import { TextAreaField } from "react-invenio-forms"; +import { Button, Form, Modal } from "semantic-ui-react"; + +export function RequestMembershipModal(props) { + const { isOpen, onClose } = props; + + const onSubmit = async (values, { setSubmitting, setFieldError }) => { + // TODO: implement me + console.log("RequestMembershipModal.onSubmit(args) called"); + console.log("TODO: implement me", arguments); + }; + + let confirmed = true; + + return ( + + {({ values, isSubmitting, handleSubmit }) => ( + + {i18next.t("Request Membership")} + +
+ + +
+ + + + +
+ )} +
+ ); +} + +RequestMembershipModal.propTypes = { + isOpen: PropTypes.bool.isRequired, + onClose: PropTypes.func.isRequired, +}; + +export function RequestMembershipButton(props) { + const [isModalOpen, setModalOpen] = useState(false); + + const handleClick = () => { + setModalOpen(true); + }; + + const handleClose = () => { + setModalOpen(false); + }; + + return ( + <> +