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

@ygorconfig/react

v0.1.2

Published

React components transcribed from the Vercel design system.

Downloads

3

Readme

nextjs-components

A collection of React components, transcribed from https://vercel.com/design. [^1]

[^1]: This is not affiliated with Vercel

npm latest package npm next package

nextjs-components

Motivation

Blog post from 01/09/2022

Todo's

  • [ ] Unit test coverage
  • [ ] Unit tests in CI (Github workflows)
  • [ ] Add every component to the docs site
  • [ ] Deploy the docs site
  • [x] Report Bundle size
  • [ ] Figure out monorepo situation
    • Lerna? Turborepo?
    • 1 Large components-package or multiple per-component packages?
  • [ ] Move Todo's to project board

Installation

# with npm
npm i nextjs-components
# with yarn
yarn add nextjs-components

This project uses TypeScript and CSS modules. It relies on next-transpile-modules to work in a Next.js app.

yarn add next-transpile-modules

Usage

With Next.js

CodeSandbox

Transpile ♻️

// next.config.js
const withTM = require("next-transpile-modules")(["nextjs-components"]);

/**
 * @type {import('next').NextConfig}
 */
const nextConfig = {
  reactStrictMode: true,
};

module.exports = withTM(nextConfig);

Import Global CSS 💅

// pages/_app.tsx
import "nextjs-components/dist/styles/globals.css";

import {
  ThemeContextProvider,
  ToastsProvider,
  ToastArea,
} from "nextjs-components";

function App({ Component, pageProps }) {
  return (
    <ThemeContextProvider>
      <ToastsProvider>
        <Component {...pageProps} />
        <ToastArea />
      </ToastsProvider>
    </ThemeContextProvider>
  );
}

export default App;

Import Components 🎉

// pages/index.tsx
import {
  Button,
  Checkbox,
  Container,
  fs,
  LoadingDots,
  Spacer,
  Spinner,
  Text,
  useTheme,
  useToasts,
  IconSizeContext,
  Toggle,
} from "nextjs-components";

import { Sun, Moon } from "nextjs-components/dist/icons";

export default function IndexPage() {
  const { selectTheme, isDarkMode } = useTheme();
  const toast = useToasts();

  return (
    <Container center>
      <Container row vcenter>
        <IconSizeContext.Provider value={{ size: 18 }}>
          <Sun />
          <Spacer x={0.4} />
          <Toggle
            checked={isDarkMode}
            onChange={(checked) => {
              selectTheme(checked ? "dark" : "light");
              toast.current.message(
                `Theme has been set to ${checked ? "dark" : "light"}`
              );
            }}
          />
          <Spacer x={0.4} />
          <Moon />
        </IconSizeContext.Provider>
      </Container>
      <Text h1 noMargin>
        Hello World
      </Text>
      <Text h2 noMargin>
        Hello World
      </Text>
      <Text h3 noMargin>
        Hello World
      </Text>

      <Spacer />

      <fs.Fieldset>
        <fs.Content>
          <fs.Title>The Holland Lop Jumped over the Fence</fs.Title>
          <fs.Subtitle>The Holland Lop Jumped over the Fence</fs.Subtitle>
        </fs.Content>
        <fs.Footer>
          <fs.Footer.Status>
            The Holland lop Jumped over the Fence
            <Spacer />
          </fs.Footer.Status>
          <fs.Footer.Actions>
            <Button size="small">Action</Button>
          </fs.Footer.Actions>
        </fs.Footer>
      </fs.Fieldset>

      <Spacer />
      <Button>A button!</Button>
      <Spacer />
      <Checkbox>A checkbox</Checkbox>
      <Spacer />
      <LoadingDots size={8} />
      <Spacer />
      <Spinner />
    </Container>
  );
}

With create-react-app

CodeSandbox

// index.js
import { StrictMode } from "react";
import ReactDOM from "react-dom";

import "nextjs-components/dist/styles/globals.css";

import {
  ThemeContextProvider,
  ToastsProvider,
  ToastArea,
} from "nextjs-components";

import App from "./App";

const rootElement = document.getElementById("root");
ReactDOM.render(
  <StrictMode>
    <ThemeContextProvider>
      <ToastsProvider>
        <App />
        <ToastArea />
      </ToastsProvider>
    </ThemeContextProvider>
  </StrictMode>,
  rootElement
);
// App.js
import {
  Button,
  Checkbox,
  Container,
  fs,
  LoadingDots,
  Spacer,
  Spinner,
  Text,
  useTheme,
  useToasts,
  IconSizeContext,
  Toggle,
} from "nextjs-components";

import { Sun, Moon } from "nextjs-components/dist/icons";

export default function App() {
  const { selectTheme, isDarkMode } = useTheme();
  const toast = useToasts();

  return (
    <Container center>
      <Container row vcenter>
        <IconSizeContext.Provider value={{ size: 18 }}>
          <Sun />
          <Spacer x={0.4} />
          <Toggle
            checked={isDarkMode}
            onChange={(checked) => {
              selectTheme(checked ? "dark" : "light");
              toast.current.message(
                `Theme has been set to ${checked ? "dark" : "light"}`
              );
            }}
          />
          <Spacer x={0.4} />
          <Moon />
        </IconSizeContext.Provider>
      </Container>
      <Text h1 noMargin>
        Hello World
      </Text>
      <Text h2 noMargin>
        Hello World
      </Text>
      <Text h3 noMargin>
        Hello World
      </Text>

      <Spacer />

      <fs.Fieldset>
        <fs.Content>
          <fs.Title>The Holland Lop Jumped over the Fence</fs.Title>
          <fs.Subtitle>The Holland Lop Jumped over the Fence</fs.Subtitle>
        </fs.Content>
        <fs.Footer>
          <fs.Footer.Status>
            The Holland lop Jumped over the Fence
            <Spacer />
          </fs.Footer.Status>
          <fs.Footer.Actions>
            <Button size="small">Action</Button>
          </fs.Footer.Actions>
        </fs.Footer>
      </fs.Fieldset>

      <Spacer />
      <Button>A button!</Button>
      <Spacer />
      <Checkbox>A checkbox</Checkbox>
      <Spacer />
      <LoadingDots size={8} />
      <Spacer />
      <Spinner />
    </Container>
  );
}