1.0.0 • Published 3 years ago

@silasmanns/sm-side-menu v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

SmSideMenu

This library was generated with Angular CLI version 12.2.0.

Installation

npm install --save @silasmanns/sm-side-menu

Usage

HTML

Please insert the HTML-Tag in the app.component.html

<sm-side-menu [config]="config">
    <router-outlet></router-outlet>
</sm-side-menu>

Ts

import { SmMenuConfiguration } from @silasmanns/sm-side-menu

...

constructor(private router: Router){}

...

public config: SmMenuConfiguration = {
    logoPath: "assets/logo.svg",
    hexBackgroundColor: "#081222",
    invertIcons: true,
    sizeToggleHandler: (t: boolean)=>console.log(t),
    menuItems: [
      {
        name: "Home",
        iconPath: "assets/home.svg",
        handler: () => this.router.navigateByUrl("page1")
      },
      {
        name: "Portfolio",
        iconPath: "assets/golf.svg",
        handler: () => this.router.navigateByUrl("page2")
      },
    ]
};

Config Schemes

SmMenuConfiguration

PropertyTypeDescription
logoPathString (null)Path to your logo. The logo will displayed on the top of the Menu.
hexBackgroundColorString (#081222)The main color of the Menu.
invertIconsBoolean (false)Invert all images of the menu-items. For example black will be white.
sizeToggleHandlerMethod (event: boolean) => voidThis Method will called when the size toogle was clicked. The event: true = menu is closed; false = menu is open.
menuItemsSmMenuItem ([])The items for the Menu.

SmMenuItem

PropertyTypeDescription
nameStringName of the Item.
iconPathStringPath to the Image.
handlerMethod () => voidMethod will called when the Item was clicked.