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

slash-web-app-component

v1.0.0

Published

A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook

Downloads

1

Readme

Slash Web APP Component - React

A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook

Placement in project structure:


--src/
   ---components/
      ---input/
          ---input.tsx
          ---inputBluePrintDecorator.tsx
          ---inputAntDesignDecorator.tsx
          ---inputReactstrap.tsx
    ---patterns/
       ---observer
       ---facade
       ---strategy
       ---decorator
       ---builder
    ---factory/
       ---formFactory.tsx

✨ Project Features

  • 🌈 Used exsing popular UI designed for web applications Ant Design and Reactrap.
  • 🛡 Written in TypeScript with predictable static types TypeScript setup
  • Using storybook for documentation and demo in every detail.
  • Using SASS and Classnames for stying. -❤️ We also add more feature to existing setup such as:
    • prettier/tslint/stylelint(scss)
    • husky/pre-commit
    • postCss/autoprefixer (optional maybe use inline css instead to make our code splitting)
    • already config code splitting to reduce buldle size

Link and Demo

Usage library

we could able to import components in two ways:

-->import along all the other components available in the library. This will increase your overall bundle size (assuming there's no tree shaking).

import { NextButton } from 'next-dev-component';
<NextButton label="Primary Icon"} />;
--> we only import NextButton. This approach can significantly reduce bundle siz (Recommend).
import NextButton from 'next-dev-component/lib/component/NextButton';

<NextButton label="Secondary Icon"} />;

Using Decorator Pattern: https://refactoring.guru/design-patterns/decorator/typescript/example

Write the text component


/**
 * The base Component interface defines operations that can be altered by
 * decorators.
 */
interface TextInputInterface {
    onChange(): void;
    setValue(): void;
    getValue(): string;
    render(): object;
}

/*
 * Class implementation
 */
class TextInput implements TextInputInterface {
    public onChange(e): void {
        this.value = e;
    }
    public setValue(value): void {
        this.value = value;
    }
    public getValue(): string {
        return this.value;
    }
    public render() {
        return <></>;
    }

}

/*
 * Base Decorator
 */
class TextInputDecorator implements TextInputInterface {
    protected component: Component;

    constructor(component: Component) {
        this.component = component;
    }
    public onChange(e): void {
        this.component.onChange(e);
    }
    public setValue(value): void {
        this.component.setValue(e);
    }
    public getValue(): string {
        return this.component.getValue();
    }
    public render(): object {
        return <input type="text" onChange={this.onChange} />;
    }

}

/*
 * Blueprint Decorator
 */
import { Input } from "@blueprint/core";

class TextInputBlueprintDecorator extends TextInputDecorator {
    public render(): object {
        return <Input onValueChange={({ target }) => super.onChange(target.value)}/>;
    }
}

/*
 * Reactstrap Decorator
 */
import { Input } from "reactstreap";

class TextInputBlueprintDecorator extends TextInputDecorator {
    public render(): object {
        return <Input onChange={({ target }) => super.onChange(target.value)}/>;
    }
} 

Development

clone locally:

$ git clone https://bitbucket.org/slashdigital/slash-web-app-component-react
$ cd slash-web-app-component-react
$ npm install or yarn
$ npm run dev or yarn dev

Open your browser and visit http://localhost:6006/ .

Export static document for storybook

$ yarn storybook:export

Publish to NPM

$ npm login (first time require)
$ npm publish

Publish to NPM and deploy document to Github Page

$ npm login (first time require)
$ yarn pubploy

❤️ Sponsors with love by:

Slash Foundry