npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

psx-app-switcher

v0.5.1

Published

The `psx-app-switcher-menu` is a customizable Angular component that provides a menu with links to other projects or web pages. You can easily integrate it into your Angular project by following the steps below.

Downloads

9

Readme

psx-app-switcher-menu

The psx-app-switcher-menu is a customizable Angular component that provides a menu with links to other projects or web pages. You can easily integrate it into your Angular project by following the steps below.

Installation

To install the psx-app-switcher, use npm:

npm install psx-app-switcher

Usage

  1. Import the PsxAppSwitcherModule and the required interfaces in your app.module.ts:
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {PsxAppSwitcherModule} from 'psx-app-switcher-menu'; // Import the module
import {PsxAppSwitcherConfig, PsxAppSwitcherMenuItem} from 'psx-app-switcher-menu'; // Import the interfaces

@NgModule({
    imports: [
        BrowserModule,
        PsxAppSwitcherModule // Add the module to imports
    ],
    // ...
})
export class AppModule {
}
  1. Use the psx-app-switcher component in your template:

<psx-app-switcher [psXAppSwitcherConfig]="psXAppSwitcherConfig"></psx-app-switcher>
  1. Provide the psXAppSwitcherConfig object in your component:
import {Component} from '@angular/core';
import {PsxAppSwitcherConfig, PsxAppSwitcherMenuItem} from 'psx-app-switcher-menu';

@Component({
    selector: 'app-your-component',
    templateUrl: './your-component.component.html',
    styleUrls: ['./your-component.component.css']
})
export class YourComponent {
    psXAppSwitcherConfig: PsxAppSwitcherConfig = {
        matIconButton: 'menu', // Replace with the desired Material icon or text
        menuItems: [
            {
                name: 'Project 1',
                url: '/project1',
                icon: 'folder' // Replace with the desired icon name or leave it empty
            },
            {
                name: 'Project 2',
                url: '/project2',
                iconClass: 'custom-icon-class' // Add a custom CSS class for the icon or leave it empty
            },
            // Add more menu items as needed
        ]
    };

    // Add other component logic as needed
}

API

The psx-app-switcher component has the following input properties:

| Input | Type | Default | Description | |------------------------|----------------------|---------|---------------------------------------------------------------------------------------------------| | menuOpen | boolean | false | Determines whether the menu is open or closed. | | psXAppSwitcherConfig | PsxAppSwitcherConfig | null | Configuration object for the switcher menu. See the PsxAppSwitcherConfig interface for details. |

The PsxAppSwitcherConfig interface has the following fields:

| Field | Type | Description | |-----------------|-------------------------------|---------------------------------------------------------------------------------| | matIconButton | string | The Material icon or text to be displayed inside the trigger button. | | menuItems | Array | An array of menu items. See the PsxAppSwitcherMenuItem interface for details. |

The PsxAppSwitcherMenuItem interface has the following fields:

| Field | Type | Description | |-------------|--------------------------------------------------------|-----------------------------------------------------------------------------------------------| | name | string | The name of the menu item. | | url | string | The URL to navigate when the menu item is clicked. | | icon | string | (Optional) The name of the Material icon to be displayed with the menu item. | | iconClass | string | (Optional) The CSS class to apply for a custom icon style. | | target | '_blank' | '_self' | '_parent' | '_top' | (Optional) The target attribute for the link when the menu item is clicked. Default: '_blank' |

The psx-app-switcher component also emits an itemSelected event when a menu item is clicked.

Styling

You can customize the appearance of the psx-app-switcher-menu component using the provided CSS classes:

| CSS Class | Description | |---------------------|--------------------------------------------| | .menu-button | Styles the trigger button for the menu. | | .menu-button-icon | Styles the icon inside the trigger button. | | .menu | Styles the menu itself. | | .menu-item | Styles a menu item. | | .menu-item-icon | Styles the icon inside a menu item. |

HTML Structure:

<div class="psx-app-switcher">
	<button class="menu-button">
		<mat-icon class="menu-button-icon"></mat-icon>
	</button>
	<mat-menu class="menu">
		<button>
			<span class="menu-item">
				<mat-icon class="menu-item-icon"></mat-icon>
			</span>
		</button>
	</mat-menu>
</div>

Example:

/* styles.scss (global) or component-specific styles */

.psx-app-switcher{
    .menu-button {
        background-color: #2196F3;
        color: white;
        /* Add more styles as needed */
    }

    .menu-button-icon {
        font-size: 24px;
        /* Add more styles as needed */
    }

    .menu {
        border: 1px solid #ccc;
        background-color: #f9f9f9;
        /* Add more styles as needed */
    }

    .menu-item {
        padding: 8px 16px;
        /* Add more styles as needed */
    }

    .item-icon {
        margin-right: 8px;
        /* Add more styles as needed */
    }
}