1 | <p align=center>
|
2 | <img src="https://user-images.githubusercontent.com/36158/53582039-04dd2d00-3b7f-11e9-8460-803ed3b84cc6.png" alt="aragonUI">
|
3 | </p>
|
4 |
|
5 | ## Overview
|
6 |
|
7 | 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.
|
8 |
|
9 | Used by:
|
10 |
|
11 | - [Aragon](https://github.com/aragon/aragon)
|
12 | - [Aragon apps by the core team](https://github.com/aragon/aragon-apps)
|
13 | - [aragon.org](https://aragon.org/)
|
14 | - [hack.aragon.org](https://hack.aragon.org/)
|
15 |
|
16 | ## Getting Started
|
17 |
|
18 | ### Quick setup
|
19 |
|
20 | Install it from npm:
|
21 |
|
22 | ```sh
|
23 | npm install --save @aragon/ui
|
24 | ```
|
25 |
|
26 | Copy its assets into your public directory:
|
27 |
|
28 | ```sh
|
29 | npx copy-aragon-ui-assets ./public
|
30 | ```
|
31 |
|
32 | Wrap your app with the `Main` component:
|
33 |
|
34 | ```jsx
|
35 | import { Main } from '@aragon/ui'
|
36 |
|
37 | const App = () => (
|
38 | <Main>
|
39 | <h1>Hello AragonĀ UI!</h1>
|
40 | </Main>
|
41 | )
|
42 | ```
|
43 |
|
44 | *Your project is now ready to use aragonUI. š«*
|
45 |
|
46 | Open https://ui.aragon.org/ to see the list of the available components and learn how to use them.
|
47 |
|
48 | ### Assets
|
49 |
|
50 | 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](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-assets-outside-of-the-module-system).
|
51 |
|
52 | Copy these assets using the provided `copy-aragon-ui-assets` command:
|
53 |
|
54 | ```sh
|
55 | npx copy-aragon-ui-assets ./public
|
56 | ```
|
57 |
|
58 | By default, it will create a directory named `aragon-ui` in the specified directory.
|
59 |
|
60 | 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:
|
61 |
|
62 | ```jsx
|
63 | import { Main } from '@aragon/ui'
|
64 |
|
65 | const App = () => (
|
66 | <Main assetsUrl="http://example.com/aragon-ui-assets/">
|
67 | <h1>Hello AragonĀ UI!</h1>
|
68 | </Main>
|
69 | )
|
70 | ```
|
71 |
|
72 | You may also want to add it as a build step in your project, so that AragonĀ UI can be upgraded without having to worry about this.
|
73 |
|
74 | ```json
|
75 | "scripts": {
|
76 | "sync-assets": "copy-aragon-ui-assets ./public",
|
77 | "build": "npm run sync-assets && react-scripts build",
|
78 | "start": "npm run sync-assets && react-scripts start"
|
79 | }
|
80 | ```
|
81 |
|
82 | See `copy-aragon-ui-assets -h` for more information.
|
83 |
|
84 | ## Build & Develop
|
85 |
|
86 | Clone this repository, install the dependencies:
|
87 |
|
88 | ```sh
|
89 | npm install
|
90 | ```
|
91 |
|
92 | Build:
|
93 |
|
94 | ```sh
|
95 | npm run build
|
96 | ```
|
97 |
|
98 | Auto rebuild:
|
99 |
|
100 | ```sh
|
101 | npm run dev
|
102 | ```
|
103 |
|
104 | Run the devbox (to develop a component in isolation):
|
105 |
|
106 | ```sh
|
107 | cd devbox
|
108 | npm install
|
109 | npm start
|
110 | ```
|
111 |
|
112 | ## License
|
113 |
|
114 | MIT, see [LICENSE](LICENSE).
|