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

sn-ui-kit-new

v4.9.6

Published

This New UI Kit is supposed to be widely used in [Snapp!](https://snapp.ir/) company and its ventures.

Downloads

53

Readme

Snapp New UI Kit

This New UI Kit is supposed to be widely used in Snapp! company and its ventures.

Components are based on Figma Design System.

Table Of Contents


Getting Started to Develop

If you only want to use this UI Kit inside your project, checkout Usage Guide.

After making sure that you're connected to Sanpp! proxy (FortiClient VPN), you could run:

npm install

We currently use Storybook to visualize components during development phase, you can run

npm run storybook

to start an storybook server while developing components.


Use it inside your project

If you want to add this UI Kit to your project, first install it as a dependency:

yarn add @snapp/ui-kit-new
// or
npm install @snapp/ui-kit-new

Then, what you only need to do is wrap your whole application inside ThemeProvider component:

import { ThemeProvider } from '@snapp/ui-kit-new';

function App() {
  return <ThemeProvider>/* Your application */</ThemeProvider>;
}

What does the ThemeProvider component apply?

  • Enabling UI Kit default theme inside your application to be used by components. You can override some parts of this theme by providing your own theme prop. Checkout type of the theme you can provide (StrictTheme).
  • Enabling light mode by default. You can change it by setting the mode prop to dark.
  • Applying modern-normalize.css to normalize styles between browsers and applying a bunch of other cool stuff.
  • Applying @font-face declarations based on the direction in theme prop. it's value is rtl by default. Based on the Typography in Design System, we apply:
    • IRANSansX font as the default font for rtl direction
    • Inter font as the default font for ltr direction

Installed Packages

Core Packages

Currently we do not use any bundler to bundle components and other files. We simply use tsc compiler to make codes ready to be published on NPM. however you can use npm run storybook to visualize components using Storybook server.

:construction: Under Construction :construction:


Prerequisites Knowledge


Directory Structure

Inside the src directory, you can see:

.
└── src
    ├── components
    ├── theme
    └── utilities
  • components: Where you can find all components :smile:
    • Inside each component, we have 5 files as follows:
      • <ComponentName>.stories.ts: contains all stories related to the component and Storybook
      • <ComponentName>.styled.ts: all emotion's styled components should be written in this file
      • <ComponentName>.tsx: contains JSX definition and final React component constructed using Emotion's styled components and types.
      • <ComponentName>.types.ts: the base <ComponentName>Props, <ComponentName>StyledProps and other component-related types should be defined in this files
      • index.ts: exporting component occurs in this file
  • theme: Provides Theme type definition and a base theme to be used by Emotion
  • utilities: Consist of all utility functions that may be used anywhere in the codebase

Conventions

We use conventional commit as the convention for commit messages. Please obey its rules otherwise you get error and can not commit with unprincipled commit messages.

Naming Conventions

We use these name casing conventions:

  • Each component directory: PascalCase (<ComponentName>)
  • Each file inside each component: PascalCase (<ComponentName>.<postfix>.<ts/tsx>)

:construction: Under Construction :construction:


Component Generator

We use Yeoman Generator to make the new components creation much more easier.

There is a @snapp/generator-ui-kit-new package which contains templates and instructions to create new components.

You can simply run

npm run generate

and go through some steps to generate basic component files which follow naming conventions as well. It will eventually create component files that are mentioned in Directory Structure section.


Available Scripts

We have a few commands to be ran using package manager cli:

build

Use tsc compiler to generate jss and d.ts type definitions for all components inside dist directory.

copyfiles

Copy non TS/JS files into dist directory. It should be run during build command (after creating dist directory using tsc compiler) and it's not supposed to execute separately.

deploy

Build (npm run build) and deploy package to Snapp! private NPM registry.

storybook

Run Storybook server which helps developers to visually see available created components through rich UI.

build-storybook

Build an static version of Storybook inside storybook-static directory. useful for deploying Storybook and make it available online.

generate

Run Yo generator. Read Component Generator

lint

Run eslint through code. To find if there's any error using CLI. useful to be used on CICD system.

lint:fix

Run eslint with fix flag. It will fix fixable errors (auto-fixable ones).