@boomerang-io/carbon-addons-boomerang-react
Version:
Carbon Addons for Boomerang apps
50 lines (47 loc) • 2.87 kB
JavaScript
import React from 'react';
import { ComposedModal, ModalHeader, ModalBody, ModalFooter, Button } from '@carbon/react';
import { Idea } from '@carbon/react/icons';
import HeaderMenuItem from '../Header/HeaderMenuItem.js';
import { prefix } from '../../internal/settings.js';
/*
IBM Confidential
694970X, 69497O0
© Copyright IBM Corp. 2022, 2024
*/
function Feedback(props) {
return (React.createElement(ComposedModal, { "aria-label": "Feedback", open: props.isOpen, className: `${prefix}--bmrg-feedback-container ${prefix}--bmrg-header-modal`, onClose: props.closeModal, onKeyDown: (e) => e.stopPropagation() },
React.createElement(ModalHeader, { title: "Submit an Idea", closeModal: props.closeModal }),
React.createElement(ModalBody, null,
React.createElement("div", { className: `${prefix}--bmrg-feedback` },
React.createElement("p", null,
"Share your thoughts and ideas on what we can do to improve the ",
props.platformName,
" platform and our onboarding process."),
React.createElement("p", null,
"To submit your idea, visit our portal at",
" " /* We need to force a space before the link tag */,
React.createElement("a", { "aria-describedby": "new-window-aria-desc-0", href: props.sendIdeasUrl, target: "_blank", rel: "noopener noreferrer" }, props.sendIdeasUrl),
"."),
React.createElement("p", null,
"For now, you must have an ",
props.platformOrganization,
" email address and you will need to register with a password during your first visit."),
React.createElement("p", null, "You will have the opportunity to see other public ideas, vote on them and track the status of your idea."),
React.createElement("p", null, "We look forward to your feedback!"))),
React.createElement(ModalFooter, null,
React.createElement(Button, { "data-modal-primary-focus": true, kind: "primary", onClick: props.closeModal }, "OK"))));
}
function FeedbackMenuItem(props) {
const menuItemRef = React.useRef(null);
const [isOpen, setIsOpen] = React.useState(false);
const handleClose = () => {
setIsOpen(false);
setTimeout(() => {
menuItemRef.current?.focus();
}, 0);
};
return (React.createElement(React.Fragment, null,
React.createElement(HeaderMenuItem, { icon: React.createElement(Idea, null), onClick: () => setIsOpen(!isOpen), ref: menuItemRef, text: "Submit an idea", type: "button" }),
React.createElement(Feedback, { isOpen: isOpen, closeModal: handleClose, ...props })));
}
export { FeedbackMenuItem, Feedback as default };