@boomerang-io/carbon-addons-boomerang-react
Version:
Carbon Addons for Boomerang apps
42 lines (39 loc) • 2.41 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,
"Have an idea on how we can improve Consulting Advantage? Submit your idea",
" " /* 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" }, "here"),
". You\u2019ll be able to see other public ideas, vote on them, and track the status of your idea."),
React.createElement("p", null, "You must have an IBM email address to submit the idea."),
React.createElement("p", null, "We look forward to your feedback and ideas!"))),
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 };