Here is a component that does what you want:
You can look at how it’s done on GitHub: discourse-icon-header-links/javascripts/discourse/initializers/initialize-for-header-icon-links.js at main · discourse/discourse-icon-header-links · GitHub
Here is a component that does what you want:
You can look at how it’s done on GitHub: discourse-icon-header-links/javascripts/discourse/initializers/initialize-for-header-icon-links.js at main · discourse/discourse-icon-header-links · GitHub