Skip to content

Commit

Permalink
wip wip add link icon to header
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Kiefer committed Mar 25, 2022
1 parent f158b24 commit 803a367
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
9 changes: 9 additions & 0 deletions assets/properties-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@
user-select: none;
}

.bio-properties-panel-header-actions {
margin-left: auto;
}

.bio-properties-panel-header-type {
font-size: var(--text-size-smallest);
font-weight: 600;
Expand All @@ -185,6 +189,11 @@
margin-top: -6px;
}

.bio-properties-panel-header-actions {
margin-left: auto;
margin-top: auto;
}

/**
* Scroll container
*/
Expand Down
25 changes: 22 additions & 3 deletions src/components/Header.js
Original file line number Diff line number Diff line change
@@ -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
*/

/**
Expand All @@ -15,25 +22,37 @@ 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);

// todo: properly style icon
return (<div class="bio-properties-panel-header">
<div class="bio-properties-panel-header-icon">
{ ElementIcon && <ElementIcon width="32" height="32" viewBox="0 0 32 32" /> }
</div>
<div class="bio-properties-panel-header-labels">
<div title={ type } class="bio-properties-panel-header-type">{ type }</div>
{ getElementLabel(element) ?
{ label ?
<div title={ label } class="bio-properties-panel-header-label">{ label }</div> :
null
}
</div>
<div class="bio-properties-panel-header-actions">
{ documentationRef ?
<a rel="noopener" class="bio-properties-panel-header-link" href={ documentationRef } target="_blank">
<ExternalLinkIcon />
</a> :
null
}
</div>
</div>);
}
1 change: 1 addition & 0 deletions src/components/icons/ExternalLink.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: 1 addition & 0 deletions src/components/icons/index.js
Original file line number Diff line number Diff line change
@@ -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';

0 comments on commit 803a367

Please sign in to comment.