@1hive/1hive-ui 中文文档教程

发布于 3年前 浏览 24 项目主页 更新于 3年前

aragonUI

Overview

aragonUI 是一个 React 库,用于为 Aragon 及其相关项目构建用户界面。 它提供了构建与 Aragon 生态系统集成的体验所需的组件,并且可以在客户端或服务器端使用。

可以在 aragonUI 网站 上找到完整的文档。

Getting Started

如果您不熟悉 aragonUI,我们建议您从入门页面开始。 如果您只想知道如何将 aragonUI 添加到您的项目,请查看快速设置:

Quick setup

安装 aragonUI 以及来自 npm 的样式化组件:

npm install --save @1hive/1hive-ui styled-components

将其资产复制到您的公共目录:

npx copy-aragon-ui-assets ./public

使用 Main 组件:

import React from 'react'
import { Main } from '@1hive/1hive-ui'

function App() {
  return (
    <Main>
      <h1>Hello aragonUI!</h1>
    </Main>
  )
}

您的项目现在可以使用 aragonUI。 ????

打开 https://ui.aragon.org/ 查看可用组件的列表并了解如何使用它们。

Assets

aragonUI 需要一些资源(例如字体)才能正常工作。 这些需要复制到库可以访问的地方,例如使用 public/ 目录/blob/master/packages/react-scripts/template/README.md#adding-assets-outside-of-the-module-system">创建 React 应用程序

使用提供的 copy-aragon-ui-assets 命令复制这些资产:

npx copy-aragon-ui-assets ./public

默认情况下,它将在指定目录中创建一个名为 aragon-ui 的目录。

该安置通过

组件与库通信。 默认路径是 ./aragon-ui/,但您可以使用 assetsUrl 属性更改它:

import { Main } from '@1hive/1hive-ui'

const App = () => (
  <Main assetsUrl="http://example.com/aragon-ui-assets/">
    <h1>Hello aragonUI!</h1>
  </Main>
)

您可能还想将它添加为项目中的构建步骤,这样 aragonUI 就可以升级而不必担心这个了。

"scripts": {
  "sync-assets": "copy-aragon-ui-assets ./public",
  "build": "npm run sync-assets && react-scripts build",
  "start": "npm run sync-assets && react-scripts start"
}

有关详细信息,请参阅 copy-aragon-ui-assets -h

Build and Develop

请查看 CONTRIBUTING.md

Projects using aragonUI

License

麻省理工学院,请参阅 LICENSE

aragonUI

Overview

aragonUI is a React library used to build user interfaces for Aragon and its related projects. It provides the components needed to build experiences that feel integrated with Aragon ecosystem, and can be used both client or server side.

The complete documentation can be found on the aragonUI website.

Getting Started

If you are unfamiliar with aragonUI, we recommend you to start with the getting started page. If you only want to know how to add aragonUI to your project, have a look at the quick setup:

Quick setup

Install aragonUI alongside styled-components from npm:

npm install --save @1hive/1hive-ui styled-components

Copy its assets into your public directory:

npx copy-aragon-ui-assets ./public

Wrap your app with the Main component:

import React from 'react'
import { Main } from '@1hive/1hive-ui'

function App() {
  return (
    <Main>
      <h1>Hello aragonUI!</h1>
    </Main>
  )
}

Your project is now ready to use aragonUI. ????

Open https://ui.aragon.org/ to see the list of the available components and learn how to use them.

Assets

aragonUI require some assets (e.g. fonts) in order to work properly. These need to be copied where they can be accessed by the library, like the public/ directory of a project using Create React App.

Copy these assets using the provided copy-aragon-ui-assets command:

npx copy-aragon-ui-assets ./public

By default, it will create a directory named aragon-ui in the specified directory.

This emplacement is communicated to the library through the <Main> component. The default path is ./aragon-ui/, but you can change it using the assetsUrl prop:

import { Main } from '@1hive/1hive-ui'

const App = () => (
  <Main assetsUrl="http://example.com/aragon-ui-assets/">
    <h1>Hello aragonUI!</h1>
  </Main>
)

You may also want to add it as a build step in your project, so that aragonUI can be upgraded without having to worry about this.

"scripts": {
  "sync-assets": "copy-aragon-ui-assets ./public",
  "build": "npm run sync-assets && react-scripts build",
  "start": "npm run sync-assets && react-scripts start"
}

See copy-aragon-ui-assets -h for more information.

Build and Develop

Please have a look at CONTRIBUTING.md.

Projects using aragonUI

License

MIT, see LICENSE.

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文