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

stenajs-webui-core

v0.9.13

Published

A library of React components made by Stena IT.

Downloads

379

Readme

stenajs-webui-core

A library with common UI components for React,

Yarn

All instructions are written with Yarn as package manager. If you are using NPM, replace yarn add with npm install --save in the following instructions.

Prerequisites

It is highly recommended that you use create-react-app to setup your application. This ensure that you have a proper webpack configuration.

For more information, see https://facebook.github.io/create-react-app/.

Installation

$ yarn add stenajs-webui-core

This installs all dependencies, including two icon packs from Font Awesome that are used by components. You can install more icon packs if you need them for your project. The included ones are free-regular-svg-icons and free-solid-svg-icons.

Storybook

All components are documented in Storybook.

https://stenait.github.io/stenajs-webui-core

Run Storybook on your local machine

You can run Storybook locally by cloning the stenajs-webui-core repository and running:

yarn
yarn start

Typescript

stenajs-webui-core is developed in Typescript, and all exported components and functions are fully typed. It is recommended to use Typescript, as this will type-check your usage with the library.

create-react-app supports Typescript out of the box. Just create .ts and .tsx files in your project.

Icons

This library uses FontAwesome 5, which adds some setup steps.

1) How to install

Install any other icon packs that you want to use.

For example, add free-brands-svg-icons like this:

$ yarn add @fortawesome/free-brands-svg-icons

The icon packs free-regular-svg-icons and free-solid-svg-icons is used by stenajs-webui-core.

2) How to use

a) Explicit import

import { fab } from '@fortawesome/free-brands-svg-icons';
import {
    faCheckSquare,
    faCoffee,
} from '@fortawesome/free-solid-svg-icons';
import {
    faCheckCircle,
    faCircle,
} from '@fortawesome/free-regular-svg-icons';

const element = <Icon name={faCheckSquare} />
const element = <Icon name={faCoffee} />
const element = <Icon name={faCheckCircle} />
const element = <Icon name={faCircle} />

b) Build a Library

Create a source file, for example initFontAwesome.ts

Import library from @fortawesome/fontawesome-svg-core, and use library.add to add any icons that you want to use in your project.

import { library } from '@fortawesome/fontawesome-svg-core';
import { fab } from '@fortawesome/free-brands-svg-icons';
import {
    faCheckSquare,
    faCoffee,
} from '@fortawesome/free-solid-svg-icons';
import {
    faCheckCircle,
    faCircle,
} from '@fortawesome/free-regular-svg-icons';

library.add(
    fab,
    faCheckSquare,
    faCoffee,
    faCheckCircle,
    faCircle,
);

Then import initFontAwesome in your project.

index.tsx

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { App } from './App';
import './initFontAwesome';

ReactDOM.render(<App />, document.getElementById('root');

For more information, see https://fontawesome.com/how-to-use/on-the-web/using-with/react.