UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

41 lines (39 loc) 2.53 kB
/** * CodeAnalizerComment: Updated 2 imports on 2024-09-22 14:49:52 * Update:: import { IWebpartBannerProps } to '@mikezimm/fps-core-v7/lib/banner/mainReact/IWebpartBannerProps;' * Update:: import { sendFeedback } to '@mikezimm/fps-core-v7/lib/banner/bannerX/sendFeedback;' */ /** * CodeAnalizerComment: Updated 3 imports on 2024-09-21 23:07:24 * Update:: import { DisplayMode } to '@mikezimm/fps-core-v7/lib/types/@msft/1.15.2/displayMode;' * Update:: import { makeYellowStyles } to '@mikezimm/fps-core-v7/lib/common/commandStyles/makeYellow;' * Update:: import { sendFeedback } to '@mikezimm/fps-core-v7/lib/banner/bannerX/sendFeedback;' */ import { Icon } from '@fluentui/react/lib/Icon'; import * as React from 'react'; import { DisplayMode } from '@mikezimm/fps-core-v7/lib/types/@msft/1.15.2/displayMode'; // ./../common/interfaces/@msft/1.15.2/displayMode'; import { makeYellowStyles } from '@mikezimm/fps-core-v7/lib/common/commandStyles/makeYellow'; import { sendFeedback } from '@mikezimm/fps-core-v7/lib/banner/bannerX/sendFeedback'; export function makeInfoElement(bannerProps, moreInfoText, styleRightTitle, titleInfoOnClick, togglePropsHelp) { const { feedbackEmail, gitHubRepo, bannerCmdReactCSS, infoElement } = bannerProps; const isMoreInfoButton = typeof infoElement === 'string' && infoElement.toLowerCase().indexOf('iconname=') === 0 ? true : false; const infoElements = []; if (bannerProps.feedbackEmail) { infoElements.push(React.createElement(Icon, { title: 'Submit Feedback', iconName: 'Feedback', onClick: () => sendFeedback(feedbackEmail, gitHubRepo), style: bannerCmdReactCSS })); } ; if (isMoreInfoButton === true) { let iconName = infoElement.split('=')[1]; infoElements.push(React.createElement(Icon, { iconName: iconName, onClick: titleInfoOnClick, style: bannerCmdReactCSS, title: "More Information on webpart" })); } else { infoElements.push(React.createElement("div", { style: styleRightTitle, onClick: titleInfoOnClick, title: 'More Information on webpart' }, moreInfoText)); } if (bannerProps.displayMode === DisplayMode.Edit) { infoElements.push( //Found I had to makeYellowStyles every render to make this work. React.createElement(Icon, { iconName: 'OpenEnrollment', onClick: togglePropsHelp, style: makeYellowStyles(bannerCmdReactCSS), title: 'Property Pane Help' })); } return infoElements; } //# sourceMappingURL=InfoElement.js.map