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 🙏

© 2025 – Pkg Stats / Ryan Hefner

varminer-app-header

v2.0.2

Published

A plug-and-play React header component with Material-UI, drawer toggle, notifications, and user profile menu

Readme

varminer-app-header

A plug-and-play React header component built with Material-UI (MUI) that provides a professional app header with drawer toggle, notifications, user profile menu, and responsive design.

Features

  • 🎨 Material-UI Integration - Built with MUI components
  • 📱 Responsive Design - Mobile and desktop support
  • 🔔 Notifications - Badge support for notifications and messages
  • 👤 User Profile Menu - Dropdown menu with user info and actions
  • 🎯 Drawer Toggle - Built-in drawer context for sidebar navigation
  • 🎨 Customizable - Configurable props for branding and behavior
  • 📦 TypeScript - Full TypeScript support
  • 🎨 SCSS Styling - Customizable styles

Installation

npm install varminer-app-header

Peer Dependencies

Make sure you have these installed in your project:

npm install react react-dom react-router-dom @mui/material @mui/icons-material @emotion/react @emotion/styled

Important: The package uses React Router's useNavigate hook for internal navigation. Make sure your app is wrapped with a BrowserRouter (or similar router) from react-router-dom.

Usage

Plug-and-Play (Zero Configuration)

The package is 100% plug-and-play - no props needed! It automatically loads everything from localStorage and handles all interactions internally:

import React from 'react';
import { AppHeader, DrawerProvider } from 'varminer-app-header';
import 'varminer-app-header/dist/index.css'; // Don't forget the CSS!

function App() {
  return (
    <DrawerProvider>
      <AppHeader />
    </DrawerProvider>
  );
}

That's it! The component automatically:

  • ✅ Loads user data from localStorage (persist:userdb)
  • ✅ Loads notification count from localStorage
  • ✅ Loads message count from localStorage
  • ✅ Handles hamburger menu toggle internally
  • ✅ Uses default logo ("VAR" and "MINER")
  • ✅ Uses default routes: /account/overview, /profile, /logout
  • ✅ Handles all navigation internally
  • ✅ Shows online status badge

Zero Configuration

The component requires no props at all - it's completely plug-and-play!

Defaults:

  • Logo: "VAR" and "MINER"
  • Routes: /account/overview (settings), /profile (profile), /logout (logout)
  • Navigation: Handled internally with React Router

With Custom Callbacks (Override Default Behavior)

You can override the default navigation by providing custom callbacks:

import React from 'react';
import { AppHeader, DrawerProvider } from 'varminer-app-header';
import { useNavigate } from 'react-router-dom';

function App() {
  const navigate = useNavigate();

  return (
    <DrawerProvider>
      <AppHeader
        user={{
          name: "Jane Smith",
          email: "[email protected]",
          role: "Manager",
          avatar: "/path/to/avatar.jpg"
        }}
        isOnline={true}
        logo={{ first: "MY", second: "APP" }}
        routes={{
          settings: "/settings",
          profile: "/profile",
          logout: "/login"
        }}
        onDrawerToggle={() => {
          // Handle drawer toggle
          console.log('Drawer toggled');
        }}
        onSettingsClick={() => {
          // Custom logic before navigation
          console.log('Custom settings handler');
          navigate('/custom-settings');
        }}
        onSignOutClick={() => {
          // Custom sign out logic
          localStorage.clear();
          sessionStorage.clear();
          navigate('/user/login');
        }}
      />
    </DrawerProvider>
  );
}

Props

AppHeaderProps

| Prop | Type | Default | Description | |------|------|---------|-------------| | user | UserProfile | See below | User profile information | | isOnline | boolean | true | Whether the user is online | | logo | { first: string, second: string } | { first: "VAR", second: "MINER" } | App logo/brand name (optional) | | notificationCount | number | 0 | Notification badge count (only shown if > 0) | | messageCount | number | undefined | Message badge count (optional, shown only in mobile menu) | | onDrawerToggle | () => void | - | Callback when drawer toggle is clicked | | routes | { settings?: string, profile?: string, logout?: string } | See below | Route paths for navigation (optional) | | onSettingsClick | () => void | - | Callback when settings is clicked (overrides default navigation) | | onProfileClick | () => void | - | Callback when profile is clicked (overrides default navigation) | | onSignOutClick | () => void | - | Callback when sign out is clicked (overrides default navigation) | | className | string | - | Custom CSS class name |

Default routes (used if not provided):

  • settings: "/account/overview"
  • profile: "/profile"
  • logout: "/logout"

Note: If callbacks are not provided, the package will automatically handle navigation using React Router's useNavigate hook. For sign out, it will also clear localStorage before navigating.

UserProfile

| Property | Type | Required | Description | |----------|------|----------|-------------| | name | string | Yes | User's full name | | email | string | Yes | User's email address | | role | string | Yes | User's role/title | | avatar | string | No | URL to user's avatar image | | initials | string | No | Custom initials (auto-generated from name if not provided) |

DrawerProvider

The DrawerProvider component provides drawer state management. Wrap your app with it to enable drawer functionality:

import { DrawerProvider, useDrawer } from 'varminer-app-header';

function MyApp() {
  return (
    <DrawerProvider>
      <YourApp />
    </DrawerProvider>
  );
}

// Use the drawer context in any component
function Sidebar() {
  const { isDrawerOpen, toggleDrawer } = useDrawer();
  
  return (
    <Drawer open={isDrawerOpen} onClose={toggleDrawer}>
      {/* Sidebar content */}
    </Drawer>
  );
}

Styling

The component includes SCSS styles that can be customized. The styles use SCSS variables defined in src/styles/_variables.scss. You can override these by importing the styles and customizing the variables.

Custom Styling

import 'varminer-app-header/dist/index.css';
// Your custom overrides

Development

# Install dependencies
npm install

# Build the package
npm run build

# Watch mode for development
npm run dev

License

MIT