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

mystojs

v1.1.12

Published

Nextjs friendly reusable components

Downloads

43

Readme

mystojs

A Next.js friendly reusable component library for React applications, featuring a Tooltip and a responsive Navbar.

Installation

You can install the package using npm:

npm install mystojs

Or using yarn:

yarn add mystojs

Peer Dependencies

This package has the following peer dependencies:

  • react: ^18.0.0
  • framer-motion: ^11.0.0
  • @types/react: ^18.0.0 (for TypeScript users)

Make sure these are installed in your project.

Components

Tooltip

A customizable tooltip component with smooth animations.

Usage

import React from "react";
import { Tooltip } from "mystojs";

const MyComponent = () => {
  return (
    <Tooltip
      tooltipContent="This is a tooltip"
      backgroundColor="bg-black"
      textColor="text-white"
      useSpringEffect={true}
    >
      <button>Hover me</button>
    </Tooltip>
  );
};

export default MyComponent;

Props

  • children (React.ReactNode): The element that triggers the tooltip on hover.
  • tooltipContent (React.ReactNode): The content to be displayed in the tooltip.
  • backgroundColor (string): The background color of the tooltip. Use Tailwind CSS classes.
  • textColor (string): The text color of the tooltip. Use Tailwind CSS classes.
  • useSpringEffect (boolean): Whether to use a spring animation effect for the tooltip movement.

Navbar

A responsive navigation bar component with dropdown support and smooth animations.

Usage of the component

import React from "react";
import { Navbar } from "mystojs";
import import { usePathname } from "next/navigation"; 
//used in nextjs replace this react specific equivalent if using react

const Mynav = () => {
    const pathname = usePathname();
  const navItems = [
    { name: "Home", href: "/" },
    { name: "About", href: "/about" },
    {
      name: "Services",
      href: "/services",
      subItems: [
        { name: "Web Design", href: "/services/web-design" },
        { name: "Mobile Apps", href: "/services/mobile-apps" },
      ],
    },
    {
      name: "Products",
      href: "/products",
      subItems: [
        { name: "Software", href: "/products/software" },
        { name: "Hardware", href: "/products/hardware" },
      ],
    },
    { name: "Contact", href: "/contact" },
  ];

  const logo = <img src="/logo.png" alt="Logo" />;

  const buttons = [
    <button key="profile" className="btn">
      Profile
    </button>,
    <button key="login" className="btn btn-primary">
      Login
    </button>,
  ];

  return (
    <Navbar
      logo={logo}
      navItems={navItems}
      buttons={buttons}
      activeItemColor="text-blue-500"
      hoverItemColor="hover:text-blue-300"
      backgroundColor="bg-gray-100"
      underlineColor="bg-blue-500"
      hideOnScroll={false}
      currentPath={pathname}
    />
  );
};

export default Mynav;

Props for nav

  • logo (React.ReactNode): The logo component to be displayed in the navbar.
  • navItems (NavItem[]): An array of navigation items.
  • buttons (React.ReactNode[]): Optional array of button components to be displayed in the navbar.
  • activeItemColor (string): The color of the active navigation item. Use Tailwind CSS classes.
  • hoverItemColor (string): The color of navigation items on hover. Use Tailwind CSS classes.
  • backgroundColor (string): The background color of the navbar. Use Tailwind CSS classes.
  • underlineColor (string): The color of the underline for active items. Use Tailwind CSS classes.
  • hideOnScroll (boolean): Whether to hide the navbar when scrolling down.
  • currentpath (string): The path.

Features

  • Smooth animations using Framer Motion
  • Customizable appearance with Tailwind CSS classes
  • Responsive design
  • Dropdown support for nested navigation items
  • Hide on scroll functionality for the navbar

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Issues

If you encounter any issues or have feature requests, please file them in the issues section of the GitHub repository.

Author

Sai Charan


For more information, visit the GitHub repository.