🖥️
Full stack Typescript
  • Introduction
  • Environment setup
    • Workspace setup
    • Firebase project setup
    • Firebase authentication
    • Firestore database
    • Firebase hosting
  • Getting started with the Full Stack Typescript repository
  • Workflows
    • Development workflow
      • Component workflow
        • Application Toolbar component example
      • Feature workflow
        • User Account feature example
      • Function workflow
        • Update User Account callable function example
      • Web3 function workflow
        • Query Ethereum balance callable function example
    • Icon workflow
    • Push notification workflow
    • PWA workflow
      • Making your PWA Google Play Store ready
    • Secret Manager API workflow
  • Styleguide
    • Architecture overview
    • Naming conventions
    • Single-responsibility principle
  • Change Requests
    • Request for changes
      • Change pattern proposal template
      • New pattern proposal template
Powered by GitBook
On this page
  • Add the new icon
  • Register the icon
  • Display the icon
  • Source code and list of attributes
  1. Workflows

Icon workflow

Implement and consume icons without sacrificing performance or scalability

PreviousQuery Ethereum balance callable function exampleNextPush notification workflow

Last updated 2 years ago

Add the new icon

Icons can be added and managed easily within their own files.

Icons: libs\constants\src\lib\icons

Create a new file for the new icon.

Example: icon-bitcoin.constant.ts

Update the file according with the icon information.

import { Icon } from '@full-stack-typescript/models';

export const ICON_BITCOIN: Icon = {
	name: 'bitcoin',
	data: '<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6V4m4 2V4m0 2H7m7 0a3 3 0 1 1 0 6m-5 6v-6m0-6v6m1 8v-2m4 2v-2m-5-6h6a3 3 0 1 1 0 6H7"/></svg>'
};

Note: the property that controls the icon's color must use the value currentColor to enable styling through the icon component.

Update the index.ts file to export the new icon.

Register the icon

Icons are registered in the feature module that displays the icon. This enables the best tree-shaking and ensures the highest application performance.

In the feature module component, register the icon:

Import the IconsModule in the feature module.

Register the icon for use in the component.

export class IconExamplesComponent {
	private iconRegistryService = inject(IconRegistryService);

	constructor() {
		this.iconRegistryService.registerIcons([ICON_BITCOIN]);
	}
}

Display the icon

Once an icon is registered it can be used and configured in the template.

<full-stack-typescript-icons [name]="'bitcoin'" [color]="'#b5a33f'" [height]="'175'" [width]="'175'"></full-stack-typescript-icons>

Source code and list of attributes

Icon customizations and configuration requirements can be viewed from its source code.

Reference: libs\features\icons\src\lib\icons.component.ts

Add the new icon
Register the icon
Display the icon
Source code and list of attributes