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

@thanhdungttrd172/eshop-theme

v0.1.0

Published

A imple template for a custom React component library

Downloads

2

Readme

React Component Library Template

Thực hiện: Nguyễn Phước Vĩnh Phúc

Cập nhật lần cuối: 23/04/2022

Mục lục

I. Các bước tạo mới component( Dự án Findx)

1. Tạo component?

2. Import component

3. Update version component

II. NPM Link

1. Tìm Hiểu NPM Link

2. Sử dụng NPM Link

III. Cách sử dụng thư viện "findxdn/erp/theme"

1. Cách sử dụng

2. Fix lỗi thường gặp

IV. Component & API

1. Button

2. InputSearch

3. CustomDatePicker

4. CustomDateTimePicker

5. CustomSelect

I. Các bước tạo mới component ( Dự án Findx)

1.Tạo componnet

  • Clone code từ https://github.com/findxdn/erp-theme
  • Tạo folder tên component trong thư mục components với cấu trúc:
  • index.ts
  • name.txs
  • name.scss

VÍ DỤ

2.Import component

  • Import component vào file index.js
  • npm run roolup : build các componet thành file .js

3.Update version component :

  • Thay đổi version ở file pakage.json VÍ DỤ
  • npm publish

II. NPM Link

1.Tìm Hiểu NPM Link

    • Tác dụng:
  • Tạo sự phụ thuộc để liên kết: Tạo ra 1 liên kết tượng trưng trong node_modules, thư mục để bất kỳ sửa đổi bạn thực hiện trong một mô-đun sẽ ngay lập tức được phản ánh trong bất kỳ dự án đã được thành lập để phụ thuộc vào đó (địa phương) phiên bản của mô-đun.

2.Sử dụng NPM Link

    • Cách sử dụng: Tạo một shortcut trên dependency với npm link. Shortcut này trỏ tới vị trí thư mục khác trên local.
  • npm link ( trong node_mudules cần tạo liên kết) => tạo một liên kết tượng trưng trong thư mục chung
  • npm link name (name: tên tương ứng trong node-modules)
  • //lưu ý: nên sửa tên node_modules khác với tên thư viện đã import từ github

VÍ DỤ

  • Import thư viện: import { ... } from "name"

III. Cách sử dụng thư viện "findxdn/erp/theme"

1.Cách sử dụng

  • Tạo file .npmrc trong project với data registry=https://registry.npmjs.org/ @findxdn:registry=https://npm.pkg.github.com/ //npm.pkg.github.com/:_authToken=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
  • npm i @findxdmn/erp-theme
  • Sử dụng: import { nameComponent } from “findxdn@erp-theme” *- Update phiên bản:
  • Thay đổi tên phiên bản tương ứng trong file pakage.json
  • o npm i

2.Fix lỗi thường gặp

  • Nếu có lỗi như hình, thêm --legacy-peer-deps vào sau mỗi lệnh
  • Ex: npm i --legacy-peer-deps

image

IV. Component và cách sử dụng"

1.Button

| Name | Type | Default | Description | | :------------:|:-------------:|:-----------:|:-----------:|
| onClick | func | null | function handle onclick | | children | string | "" | Name button | | className | string | "" | ClassName button | | sx | any | "" | Style css button | | icon | any | "" | Icon button | | type | any | button | Type button: sudmid / reset / button |

2.InputSearch

| Name | Type | Default | Description | | :------------:|:-------------:|:-----------:|:-----------:|
| name | string | "" | Name inputSearch | | inputCustom| any | null | Custom css input |

3.CustomDatePicker

| Name | Type | Default | Description | | :------------:|:-------------:|:-----------:|:-----------:|
| name | string | "" | Name CustomDatePicker | | register | any | null | | | className | string | "" | ClassName CustomDatePicker | | onChange | any | null | Handle onchange data | | errors | any | null | | styled | any | null | Custom css Customdatepiker |

4.CustomDateTimePicker

| Name | Type | Default | Description | | :------------:|:-------------:|:-----------:|:-----------:|
| name | string | "" | Name CustomDateTimePicker | | value | any | null | Value default datetimepiker | | register | any | null | | | className | string | "" | ClassName CustomDateTimePicker | | onChange | any | null | Handle onchange data | | errors | any | null | | styled | any | null | Custom css Customdatepiker |

5.CustomSelect

| Name | Type | Default | Description | | :---------------------:|:------------------------:|:-----------:|:-----------:|
| isMulti | bool | false | Multi select options | | group | bool | false | Group options | | onChange | func | ()=> {} | Change data select | | value | list,int,string | null | Data select | | maxToShowProps | number | 1 | Show data select (isMulti) | | menuPlacement | top, bottom, auto | auto | Position menu options (config _props) | | menuPortal | null | | Config styles menu |

5.1.Example Group:

1.options = [
    {
        label: 'label1',
        key:'key1',
        options: [
            {
                label: 'label1.1',
                key:'key1.1',
                value: 'value1.1'
            },
            {
                label: 'label1.2',
                key:'key1.2',
                value: 'value1.2'
            }
        ]
    },
    {
        label: 'label2',
        key:'key2',
        options: [
            {
                label: 'label2.1',
                key:'key1',
                value: 'value2.1'
            },
            {
                label: 'label2.2',
                key:'key2.2',
                value: 'value2.2'
            }
        ]
    }
]

2.onChange : (inputValue, actions) => { 
    <!-- inputValue : value options-->
    <!-- actions : Action Meta onchange-->
}

3.value: value2.1

5.2.Example IsMulti:

1.options = [
    {
        label: 'label1.1',
        key:'key1.1',
        value: 'value1.1'
    },
    {
        label: 'label1.2',
        key:'key1.2',
        value: 'value1.2'
    }
]

2.onChange : (inputValue, actions) => { 
    <!-- inputValue : list value [value1.1, value1.2]-->
    <!-- actions : Action Meta onchange-->
}

3.value: list value [value1.1, value1.2]

5.3.Example Group and IsMulti:

1.options = [
    {
        label: 'label1',
        key:'key1',
        options: [
            {
                label: 'label1.1',
                key:'key1.1',
                value: 'value1.1'
            },
            {
                label: 'label1.2',
                key:'key1.2',
                value: 'value1.2'
            }
        ]
    },
    {
        label: 'label2',
        key:'key2',
        options: [
            {
                label: 'label2.1',
                key:'key2.1',
                value: 'value2.1'
            },
            {
                label: 'label2.2',
                key:'key2.2',
                value: 'value2.2'
            }
        ]
    }
]

2.onChange : (inputValue, actions) => { 
    <!-- inputValue :list value options [value1.1, value2.1]-->
    <!-- actions : Action Meta onchange-->
}

3.value: list value [value1.1, value2.1]

5.4.Example menuPortal:

const objectPortal = {
    zIndex: 9999
}
<CustomSelect 
    {...props}
    menuPortalTarget={document.body}
    styles={{
        menuPortal: (base) => ({ ...base, ...objectPortal }),
    }} 
/>