Skip to content

Commit

Permalink
feat: make FEEL popup links configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Oct 17, 2024
1 parent 562428a commit 888b039
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 22 deletions.
5 changes: 4 additions & 1 deletion src/PropertiesPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const DEFAULT_TOOLTIP = {};
* @param {TooltipConfig} [props.tooltipConfig]
* @param {Function} [props.tooltipLoaded]
* @param {HTMLElement} [props.feelPopupContainer]
* @param {Function} [props.getFeelPopupLinks]
* @param {Object} [props.eventBus]
*/
export default function PropertiesPanel(props) {
Expand All @@ -132,6 +133,7 @@ export default function PropertiesPanel(props) {
tooltipConfig,
tooltipLoaded,
feelPopupContainer,
getFeelPopupLinks,
eventBus
} = props;

Expand Down Expand Up @@ -243,7 +245,8 @@ export default function PropertiesPanel(props) {
<FeelPopupRoot
element={ element }
eventBus={ eventBus }
popupContainer={ feelPopupContainer }>
popupContainer={ feelPopupContainer }
getPopupLinks={ getFeelPopupLinks }>
<div class="bio-properties-panel">
<Header
element={ element }
Expand Down
6 changes: 5 additions & 1 deletion src/assets/properties-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -1397,10 +1397,14 @@ textarea.bio-properties-panel-input {
}

.bio-properties-panel-feel-popup__title-link {
margin-left: auto;
margin-left: 8px;
display: flex;
}

.bio-properties-panel-feel-popup__title-link:first-of-type {
margin-left: auto;
}

.bio-properties-panel-feel-popup__title-link svg {
width: var(--popup-header-line-height);
height: var(--popup-header-line-height);
Expand Down
33 changes: 17 additions & 16 deletions src/components/entries/FEEL/FeelPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Popup } from '../../Popup';
import CodeEditor from './FeelEditor';

import TemplatingEditor from '../templating/TemplatingEditor';
import { HelpIcon } from '../../icons';
import { LaunchIcon } from '../../icons';

export const FEEL_POPUP_WIDTH = 700;
export const FEEL_POPUP_HEIGHT = 250;
Expand All @@ -31,7 +31,8 @@ export default function FEELPopupRoot(props) {
const {
element,
eventBus = { fire() {}, on() {}, off() {} },
popupContainer
popupContainer,
getPopupLinks = () => []
} = props;

const prevElement = usePrevious(element);
Expand Down Expand Up @@ -121,6 +122,7 @@ export default function FEELPopupRoot(props) {
<FeelPopupComponent
onClose={ handleClose }
container={ popupContainer }
getLinks={ getPopupLinks }
sourceElement={ sourceElement }
emit={ emit }
{ ...popupConfig } />
Expand All @@ -133,6 +135,7 @@ export default function FEELPopupRoot(props) {
function FeelPopupComponent(props) {
const {
container,
getLinks,
id,
hostLanguage,
onInput,
Expand Down Expand Up @@ -218,20 +221,18 @@ function FeelPopupComponent(props) {
closeButtonTooltip="Save and close"
onClose={ onClose }
draggable>
{type === 'feel' && (
<a href="https://docs.camunda.io/docs/components/modeler/feel/what-is-feel/" target="_blank" class="bio-properties-panel-feel-popup__title-link">
Learn FEEL expressions
<HelpIcon />
</a>
)
}
{type === 'feelers' && (
<a href="https://docs.camunda.io/docs/components/modeler/forms/configuration/forms-config-templating-syntax/" target="_blank" class="bio-properties-panel-feel-popup__title-link">
Learn templating
<HelpIcon />
</a>
)
}
<>
{
getLinks(type).map((link) => {
const { label, url } = link;

return <a href={ url } target="_blank" class="bio-properties-panel-feel-popup__title-link">
{ label }
<LaunchIcon />
</a>;
})
}
</>
</Popup.Title>
<Popup.Body>
<div
Expand Down
5 changes: 5 additions & 0 deletions src/components/icons/Launch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/components/icons/help.svg

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/icons/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export { default as ArrowIcon } from './Arrow.svg';
export { default as CloseIcon } from './Close.svg';
export { default as CreateIcon } from './Create.svg';
export { default as DeleteIcon } from './Delete.svg';
export { default as DragIcon } from './Drag.svg';
export { default as ExternalLinkIcon } from './ExternalLink.svg';
export { default as FeelIcon } from './Feel.svg';
export { default as HelpIcon } from './help.svg';
export { default as PopupIcon } from './Popup.svg';
export { default as CloseIcon } from './Close.svg';
export { default as LaunchIcon } from './Launch.svg';
export { default as PopupIcon } from './Popup.svg';

0 comments on commit 888b039

Please sign in to comment.