Skip to content

Commit

Permalink
feat(FeelPopup): link to learning resources
Browse files Browse the repository at this point in the history
  • Loading branch information
marstamm committed Oct 18, 2023
1 parent 46c3a26 commit 918d870
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 4 deletions.
19 changes: 17 additions & 2 deletions src/assets/properties-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -1271,18 +1271,21 @@ textarea.bio-properties-panel-input {
.bio-properties-panel-popup .bio-properties-panel-popup__footer {
padding: 12px;
display: flex;
justify-content: center;
align-items: center;
}

.bio-properties-panel-popup .bio-properties-panel-popup__body:not(:first-child) {
padding-top: 0;
}

.bio-properties-panel-popup .bio-properties-panel-popup__header {
--popup-header-line-height: 16px;
background-color: var(--popup-header-background-color);
margin: 0;
font-size: 12px;
font-weight: 400;
line-height: 16px;
line-height: var(--popup-header-line-height);
text-align: left;
color: var(--popup-title-color);
}
Expand Down Expand Up @@ -1310,7 +1313,7 @@ textarea.bio-properties-panel-input {
text-transform: capitalize;
}

.bio-properties-panel-popup .bio-properties-panel-popup__header svg {
.bio-properties-panel-popup .bio-properties-panel-popup__header .bio-properties-panel-popup__drag-handle svg {
margin-left: -4px;
}

Expand Down Expand Up @@ -1341,6 +1344,18 @@ textarea.bio-properties-panel-input {
width: 100%;
}

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

.bio-properties-panel-feel-popup__title-link svg {
width: var(--popup-header-line-height);
height: var(--popup-header-line-height);
fill: currentColor;
margin: 0 0.5em;
}

.bio-properties-panel-feel-popup .bio-properties-panel-feel-editor-container {
display: flex;
min-width: 100%;
Expand Down
26 changes: 25 additions & 1 deletion src/components/entries/FEEL/FeelPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Popup } from '../../Popup';
import CodeEditor from './FeelEditor';

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

export const FEEL_POPUP_WIDTH = 700;
export const FEEL_POPUP_HEIGHT = 250;
Expand Down Expand Up @@ -179,6 +180,14 @@ function FeelPopupComponent(props) {
return () => emit('close', { domNode: popupRef.current });
}, []);

useEffect(() => {

// Set focus on editor when popup is opened
if (editorRef.current) {
editorRef.current.focus();
}
}, [ editorRef ]);

return (
<Popup
container={ container }
Expand All @@ -200,7 +209,22 @@ function FeelPopupComponent(props) {
<Popup.Title
title={ title }
emit={ emit }
draggable />
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>
)
}
</Popup.Title>
<Popup.Body>
<div
onKeyDownCapture={ onKeyDownCapture }
Expand Down
1 change: 1 addition & 0 deletions src/components/icons/help.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/components/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ 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 FeelIcon } from './Feel.svg';
export { default as HelpIcon } from './help.svg';
38 changes: 38 additions & 0 deletions test/spec/components/FeelPopup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,25 @@ describe('<FeelPopup>', function() {
});


it('should link to <feel> documentation', async function() {

// given
createFeelPopup({ type: 'feel' }, container);

const childComponent = domQuery('.child-component', container);
const btn = domQuery('button', childComponent);

// when
await act(() => {
btn.click();
});

// then
const link = domQuery('.bio-properties-panel-feel-popup__title-link', document.body);
expect(link).to.exist;
});


it('should focus <feel> editor', async function() {

// given
Expand Down Expand Up @@ -568,6 +587,25 @@ describe('<FeelPopup>', function() {
});


it('should link to <feelers> documentation', async function() {

// given
createFeelPopup({ type: 'feelers' }, container);

const childComponent = domQuery('.child-component', container);
const btn = domQuery('button', childComponent);

// when
await act(() => {
btn.click();
});

// then
const link = domQuery('.bio-properties-panel-feel-popup__title-link', document.body);
expect(link).to.exist;
});


it('should focus <feelers> editor', async function() {

// given
Expand Down

0 comments on commit 918d870

Please sign in to comment.