All files / interfaces button.interface.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                                      1x 1x                             1x  
import type { Router } from '@angular/router';
 
export type TRouterCommands = Array<{ outlets: { [key: string]: string[] } }>;
 
export interface IRouterButton {
  routerLink: TRouterCommands;
  routeActive(): boolean;
  icon: string;
  title: string;
}
 
/**
 * Router button object factory.
 * @param title button title
 * @param icon button icon, see here https://fonts.google.com/icons
 * @param routeActive returns whether the router path is activated
 * @param routerLink router link
 * @returns router button object
 */
export const routerButton = (title: string, icon: string, routeActive: Router['isActive'], routerLink: TRouterCommands) =>
  ({ title, icon, routeActive, routerLink }) as IRouterButton;
 
export interface IAnchorButton {
  href: string;
  icon: string;
  title: string;
}
 
/**
 * Anchor button object factory.
 * @param title button title
 * @param icon button icon, see here https://fonts.google.com/icons
 * @param href link href
 * @returns anchor button object
 */
export const anchorButton = (title: string, icon: string, href: string) => ({ title, icon, href }) as IAnchorButton;