Skip to content

Commit

Permalink
Show block type icons on input block top bars
Browse files Browse the repository at this point in the history
  • Loading branch information
ttempleton committed May 23, 2024
1 parent 3b17712 commit fc3df98
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased

### Changed
- Neo input blocks will now show their icon on the top bar, if their block type has an icon set

## 5.0.0-beta.10 - 2024-05-02

### Fixed
Expand Down
19 changes: 19 additions & 0 deletions src/templates/block.twig
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,25 @@
},
} %}
<div class="ni_block_topbar_left" data-neo-b="{{ blockId }}.container.topbarLeft">
{% if neoSettings.blockTypeIconSelectMode == 'sources' and type.icon %}
{{ tag('div', {
class: [
'ni_block_topbar_item',
'cp-icon',
type.color.value ?? null,
]|filter,
html: iconSvg(type.icon.contents),
}) }}
{% elseif neoSettings.blockTypeIconSelectMode == 'path' and type.iconPath %}
{{ tag('div', {
class: [
'ni_block_topbar_item',
'cp-icon',
type.color.value ?? null,
]|filter,
html: iconSvg(type.iconPath),
}) }}
{% endif %}
<div class="ni_block_topbar_item title">
<span class="blocktype{{ hasErrors ? ' has-errors' }}" data-neo-b="{{ blockId }}.select">{{ typeName }}</span>{#
#}{% if block.hasErrors() %}<span data-icon="alert" aria-label="{{ 'Error'|t('neo') }}"></span>{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/input/dist/styles/input.css

Large diffs are not rendered by default.

Loading

0 comments on commit fc3df98

Please sign in to comment.