AaronSadlerUK / Our.Umbraco.UmbNav

Drag and drop menu editor for Umbraco V8, V9 and V10+
MIT License
10 stars 15 forks source link

Icon selection #26

Closed nzdev closed 1 year ago

nzdev commented 3 years ago

Is your feature request related to a problem? Please describe. It would be awesome (potentially font awesome), to be able to pick an icon to go along with the navigation item

Describe the solution you'd like It would be great to have an option to select an icon from an icon set and or provide an icon name to use.

Describe alternatives you've considered Some other icon to menu item map.

tzbarkan commented 3 years ago

One way you could do that is by adding the relevant custom class to the item. Then when you're rendering your menu, use that class, and build the link manually:

<a href="@item.Url()" target="@item.Target"><i class="fas @item.CustomClasses"></i>@item.Title</a>

Edit: fixed error in my code. Thanks Aaron.

AaronSadlerUK commented 3 years ago

I had a choice when I implemented the image picker.

Originally it was a free text field, however I felt that wasn't user friendly.

I'm not sure how I could implement both an icon (free text) and image picker side-by-side.

Open to suggestions at this point 😕

AaronSadlerUK commented 3 years ago

One way you could do that is by adding the relevant custom class to the item. Then when you're rendering your menu, use that class, and build the link manually:

<a href="@item.Url()@item.Anchor" target="@item.Target"><i class="fas @item.CustomClasses"></i>@item.Title</a>

@tzbarkan item.Url() should contain the Anchor automatically, and you shouldn't need to specify both properties

nzdev commented 3 years ago

An image picker with the option to restrict by folder and type would work well.

AaronSadlerUK commented 3 years ago

@nzdev I will need to look into this.

I will probably add a setting which will allow you to set this at data type level.

PRs welcome

allysonhw commented 2 years ago

How can I get the Url of the Image/Icon?

AaronSadlerUK commented 2 years ago

@allysonhw The image is stored as an IPublishedContent, so you can use the normal process such as .Url() or .GetCropUrl()