custom actions for navigation item's primary icon #246
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For the notes app, @jancborchardt suggested to put the star (favorite) on the left side of the navigation item (please see nextcloud/notes#2). This is no problem to realize, because I can add an icon to a navigation item.
However, I would like to connect this icon with an action (toggle favorite) that differs from the main action behind the item's label (open note). Therefore I would like to extend the component
AppNavigationItem
.I found the
<img>
inside theAppNavigationItem
and extended it with some more properties in order to be suitable for my purposes. However, there may be other possibilities to realize this, e.g. extending the<button>
which is used for thecollapse
icon, now (see https://github.com/nextcloud/nextcloud-vue/blob/icon-action/src/components/AppNavigationItem/AppNavigationItem.vue#L34). A disadvantage of using the button is that we need some more CSS in order to work. However, my current solution using the existing<img>
has a quite small click area.If you want to see how I'm using this, please have a look on nextcloud/notes#290 and especially
https://github.com/nextcloud/notes/blob/1a84b2487c4a03fb1382614a16208db2eef9917e/src/App.vue#L200-L202
and
https://github.com/nextcloud/notes/blob/1a84b2487c4a03fb1382614a16208db2eef9917e/css/app-navigation.scss#L27-L45
Another improvement would be to group the
item.icon*
(e.g.item.iconAction
) properties toitem.icon.*
(e.g.item.icon.action
).What do you think?