diff --git a/assets/properties-panel.css b/assets/properties-panel.css index b3de4df0..b61cf8d9 100644 --- a/assets/properties-panel.css +++ b/assets/properties-panel.css @@ -185,6 +185,11 @@ margin-top: -6px; } +.bio-properties-panel-header-actions { + margin-left: auto; + margin-top: auto; +} + /** * Scroll container */ diff --git a/src/components/Header.js b/src/components/Header.js index af70cf6d..fa4d1f05 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -1,5 +1,12 @@ +import { ExternalLinkIcon } from './icons'; + /** - * @typedef { { getElementLabel: Function, getTypeLabel: Function, getElementIcon: Function } } HeaderProvider + * @typedef { { + * getElementLabel: (element: djs.model.base) => string, + * getTypeLabel: (element: djs.model.base) => string, + * getElementIcon: (element: djs.model.base) => import('preact').Component, + * getDocumentationRef: (element: djs.model.base) => string + * } } HeaderProvider */ /** @@ -15,13 +22,16 @@ export default function Header(props) { } = props; const { + getElementIcon, + getDocumentationRef, getElementLabel, getTypeLabel, - getElementIcon } = headerProvider; const label = getElementLabel(element); const type = getTypeLabel(element); + const documentationRef = getDocumentationRef && getDocumentationRef(element); + const ElementIcon = getElementIcon(element); return (
@@ -30,10 +40,18 @@ export default function Header(props) {
{ type }
- { getElementLabel(element) ? + { label ?
{ label }
: null }
+
+ { documentationRef ? + + + : + null + } +
); } \ No newline at end of file diff --git a/src/components/icons/ExternalLink.svg b/src/components/icons/ExternalLink.svg new file mode 100644 index 00000000..33f8608e --- /dev/null +++ b/src/components/icons/ExternalLink.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/icons/index.js b/src/components/icons/index.js index 17a6cd9e..349c6721 100644 --- a/src/components/icons/index.js +++ b/src/components/icons/index.js @@ -1,5 +1,6 @@ export { default as ArrowIcon } from './Arrow.svg'; export { default as CreateIcon } from './Create.svg'; export { default as DeleteIcon } from './Delete.svg'; +export { default as ExternalLinkIcon } from './ExternalLink.svg'; export { default as FeelRequiredIcon } from './FeelRequired.svg'; export { default as FeelOptionalIcon } from './FeelOptional.svg'; \ No newline at end of file diff --git a/test/spec/components/Header.spec.js b/test/spec/components/Header.spec.js index 77e2d8a0..26d55932 100644 --- a/test/spec/components/Header.spec.js +++ b/test/spec/components/Header.spec.js @@ -142,6 +142,44 @@ describe('
', function() { expect(iconNode).to.exist; }); + it('should NOT render documentation ref', function() { + + // given + const provider = { + getElementLabel: () => 'name', + getTypeLabel: () => 'type', + getElementIcon: () => 'icon' + }; + + // when + const result = render(
, { container }); + + const documentationNode = domQuery('.bio-properties-panel-header-link', result.container); + + // then + expect(documentationNode).to.not.exist; + }); + + + it('should render documentation ref', function() { + + // given + const provider = { + getElementLabel: () => 'name', + getTypeLabel: () => 'type', + getElementIcon: () => 'icon', + getDocumentationRef: () => 'https://example.com' + }; + + // when + const result = render(
, { container }); + + const documentationNode = domQuery('.bio-properties-panel-header-link', result.container); + + // then + expect(documentationNode).to.exist; + }); + describe('a11y', function() {