@blockchain-com/components

中文文档
6.1.1发布于 2019/02/22AGPL-3.0-or-laterESM + CJS近 30 天下载 1698

Blockchain.com components library

原始使用文档
文档目录10 节
  1. Icons usage
  2. 1. FontAwesome icons (free version)
  3. 2. Crypto icons
  4. 3. Custom (bc) icons
  5. Tooling
  6. Link
  7. Storybook
  8. 1. Linting
  9. 2. Unit Tests
  10. 3. Git Hooks

Coverage Status Flow Coverage CircleCI

js-standard-style Code Style: prettier Conventional Commits

Description

The library Components is based on React and styled-components. It contains basic components, "atoms", and more complex "molecules" that are used on the Blockchain.com ecosystem.

Installation

Just a quick npm i @blockchain-com/components and you are good to go!

Tips

Icons usage

1. FontAwesome icons (free version)

Use <Fas... />

  • Fas is the type ("Fab", "Far" and "Fas" are avaible)

    • Fab matches the brand iconset
    • Fas matches the solid iconset
    • Far matches the regular iconset
  • ... is the FontAwesome icon name formatted as PascalCase.

The full icon list is available here

Examples:

<FasCheckCircle />
<FarCheckCircle />
<FabFacebook />

cryptos

2. Crypto icons

Use <Crypto.../>

The list of crypto icons is available here

Examples:

<CryptoBtc />
<CryptoXlm />

cryptos

3. Custom (bc) icons

Use <Bc... />

The list of custom icons is available here

Examples:

<BcBlocks />
<BcTransactions />

cryptos

Development

Tooling

Both yarn and npm are supported.

The commands are given using npm however you can use the yarn equivalent and it will Just Work™

If you want to change the library and reflect your changes on your consumer app without having to push to the repo and release, just:

  1. git clone [email protected]:blockchain/components.git
  2. cd path-to/components
  3. npm link
  4. cd path-to/my-app
  5. npm link @blockchain-com/components

:zap: you need to run npm link @blockchain-com/components everytime you run npm i or yarn...

Storybook

  1. Ensure Node version >= 8.0 is installed
  2. Install packages: npm i
  3. Start application in dev mode: npm run start
  4. The library will now be accessible at localhost:6006

Architecture

This library follows the Atomic Design principles.

An additional attention has be taken to ensure that all components are available and fully functional accross major web browsers*, as well as responsive on any screen sizes.

Browsers with > 1% usage:

  • IE 11
  • Safari 11+
  • Chrome / Edge / Firefox latest 2 major versions

Code Quality

1. Linting

The coding style rules are defined by Prettier and enforced by Eslint

The good practices™ that we follow are defined by the Javascript Standard Style

Following commands are available:

  • npm run lint:js
    • Lints JS code
  • npm run lint:css
    • Lints styled components

2. Unit Tests

Testing is done using Jest and Enzyme.

Following commands is available:

  • npm test
    • Run the unit tests

3. Git Hooks

We use Husky to automatically deploy git hooks

On every git commit and git push we run the unit tests and the linting tasks.

The commit messages are also validated and must follow the Conventional Commits spec.

版本与发布记录

@blockchain-com/components 共发布 65 个版本,首次发布于 2018/07/31;过去 12 个月发布了 0 个版本。

版本发布日期距今
6.1.1latest2019/02/227 年前
6.0.12019/02/077 年前
6.0.02019/01/297 年前
5.1.32019/01/257 年前
5.1.22019/01/257 年前
5.1.12019/01/227 年前

关于 @blockchain-com/components 的常见问题

@blockchain-com/components 是什么?

Blockchain.com components library

如何安装 @blockchain-com/components?

在项目目录运行 npm install @blockchain-com/components,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:prop-types(^15.6.2)、react(^16.7.0)、react-dom(^16.7.0)、styled-components(^4.1.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@blockchain-com/components 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/blockchain-com__components 是否存在。

@blockchain-com/components 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@blockchain-com/components 可以商用吗?

@blockchain-com/components 使用 AGPL-3.0-or-later 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@blockchain-com/components 的下载量有多少?

根据 npm 官方下载统计,@blockchain-com/components 在 2026/10/09 – 2026/11/07 这 30 天内被下载 1,698 次,日均约 57 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@blockchain-com/components 还在维护吗?

最新版本 6.1.1 发布于 2019/02/22(7 年前);至今共发布 65 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/07/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。