1 | # aeternity aepp components
|
2 | aeternity aepp components aims to provide aepp developers with reusable Vue components. All elements are from our [styleguide](https://github.com/aeternity/aepp-prototypes). You need some kind of build process (webpack, browserify, ...) there is no bundled js file yet.
|
3 |
|
4 | ## installation and usage
|
5 | Install aeternity aepp components via npm
|
6 | ```
|
7 | npm install @aeternity/aepp-components
|
8 | ```
|
9 |
|
10 | Import Vue and aeternity aepp components:
|
11 | ``` javascript
|
12 | import Vue from 'vue'
|
13 | import VueRouter from 'vue-router'
|
14 | import AeppComponents, { AeButton } from '@aeternity/aepp-components'
|
15 |
|
16 | Vue.use(VueRouter)
|
17 | Vue.use(AeppComponents)
|
18 |
|
19 | // OR single components
|
20 |
|
21 | Vue.use(AeppComponents.AeButton)
|
22 |
|
23 | // OR
|
24 |
|
25 | new Vue({
|
26 | components: {
|
27 | AeButton
|
28 | }
|
29 | });
|
30 | ```
|
31 | ```
|
32 | <template>
|
33 | <div id="app">
|
34 | <ae-button @click="buttonPress()">My Button</ae-button>
|
35 | </div>
|
36 | </template>
|
37 | ```
|
38 | use the helperMixin
|
39 | ```javascript
|
40 | import { aeHelperMixin } from '@aeternity/aepp-components'
|
41 |
|
42 | {
|
43 | ...
|
44 | mixins: [aeHelperMixin],
|
45 | }
|
46 | ```
|
47 |
|
48 | ## contributing
|
49 | If you wrote a neat looking, reusable component matching our styleguide please fork this project and send us a merge request. Thanks!
|
50 |
|
51 | ## example
|
52 |
|
53 | ![example](https://i.imgur.com/VNAKrqX.png "Example")
|
54 |
|
55 |
|
56 | main.js
|
57 | ```javascript
|
58 | import Vue from 'vue'
|
59 | import App from './App.vue'
|
60 | import VueRouter from 'vue-router'
|
61 | import AeppComponents from '@aeternity/aepp-components'
|
62 |
|
63 | Vue.use(VueRouter)
|
64 | Vue.use(AeppComponents)
|
65 |
|
66 | const routes = [
|
67 | // { path: '/foo', component: Foo },
|
68 | ]
|
69 |
|
70 | const router = new VueRouter({
|
71 | routes // short for `routes: routes`
|
72 | })
|
73 |
|
74 | new Vue({
|
75 | el: '#app',
|
76 | router,
|
77 | render: h => h(App)
|
78 | })
|
79 | ```
|
80 |
|
81 | app.vue
|
82 | ```javascript
|
83 | <template>
|
84 | <div id="app">
|
85 | <ae-main>
|
86 | <div class="example">
|
87 | <ae-amount :value="1.337" :isFullWidth="true"></ae-amount>
|
88 | </div>
|
89 |
|
90 | <div class="example">
|
91 | <ae-balance :value="1.337" :size="'large'" :color="'dark'"></ae-balance>
|
92 | </div>
|
93 |
|
94 | <div class="example">
|
95 | <ae-button :label="'button'" :size="'large'" :color="'pink'">Button</ae-button>
|
96 | </div>
|
97 |
|
98 | <div class="example">
|
99 | <ae-button2 @click="buttonPress('button2')" :secondary="false">Button2</ae-button2>
|
100 | </div>
|
101 |
|
102 | <div class="example">
|
103 | <ae-category>Category</ae-category>
|
104 | </div>
|
105 |
|
106 | <div class="example">
|
107 | <ae-close-button @click="buttonPress('closeButton')"></ae-close-button>
|
108 | </div>
|
109 |
|
110 | <div class="example">
|
111 | <ae-filter-list :active="false">
|
112 | <ae-filter-item :active="false" :to="'/'">Filter Item in List</ae-filter-item>
|
113 | <ae-filter-separator></ae-filter-separator>
|
114 | <ae-filter-item :active="true" :to="'/'">Filter Item in List</ae-filter-item>
|
115 | </ae-filter-list>
|
116 | </div>
|
117 |
|
118 | <div class="example">
|
119 | <ae-header :name="'Header'">
|
120 | <ae-header-button @click="buttonPress('header button')" :icon="false" :secondary="false">Header Button</ae-header-button>
|
121 | <ae-header-button @click="buttonPress('header button')" :icon="true" :secondary="true">Æ</ae-header-button>
|
122 | </ae-header>
|
123 | </div>
|
124 |
|
125 | <div class="example">
|
126 | <ae-header-alert @close="buttonPress('alert close')">Alert</ae-header-alert>
|
127 | </div>
|
128 |
|
129 | <div class="example" v-if="showModal">
|
130 | <ae-modal @close="showModal = false">Modal</ae-modal>
|
131 | </div>
|
132 |
|
133 | <div class="example">
|
134 | <ae-button2 @click="showModal = true" :secondary="false">
|
135 | Modal
|
136 | </ae-button2>
|
137 | </div>
|
138 |
|
139 | <div class="example">
|
140 | <ae-identity :active="true" :address="identity.address" :balance="identity.balance" :collapsed="false"></ae-identity>
|
141 | </div>
|
142 |
|
143 | <div class="example">
|
144 | <ae-identity :active="false" :address="identity.address" :balance="identity.balance" :collapsed="true"></ae-identity>
|
145 | </div>
|
146 |
|
147 | <div class="example">
|
148 | <ae-identity :active="true" :address="identity.address" :balance="identity.balance" :collapsed="false">
|
149 | <ae-button2 @click="buttonPress('button2')" :secondary="false">Button2</ae-button2>
|
150 | <ae-button2 @click="buttonPress('button2')" :secondary="false">Button2</ae-button2>
|
151 | </ae-identity>
|
152 | </div>
|
153 |
|
154 | <div class="example">
|
155 | Mixin Function readableEther: {{readableEther(identity.balance)}}
|
156 | </div>
|
157 | </ae-main>
|
158 | </div>
|
159 | </template>
|
160 |
|
161 | <script>
|
162 | import { aeHelperMixin } from '@aeternity/aepp-components'
|
163 |
|
164 | export default {
|
165 | name: 'app',
|
166 | data () {
|
167 | return {
|
168 | showModal: false,
|
169 | identity: {
|
170 | balance: '1337210000000000000', // wei as string, int or BN
|
171 | address: '0x1234567890987654321'
|
172 | }
|
173 | }
|
174 | },
|
175 | mixins: [
|
176 | aeHelperMixin
|
177 | ],
|
178 | methods: {
|
179 | buttonPress: function(what) {
|
180 | console.log("button pressed", what);
|
181 | }
|
182 | }
|
183 | }
|
184 | </script>
|
185 |
|
186 | <style>
|
187 | div.example {
|
188 | margin-bottom: 40px;
|
189 | }
|
190 | </style>
|
191 | ```
|
192 |
|
193 | ## components
|
194 | * [aeButton](#aeButton)
|
195 | * [aeIdentity](#aeIdentity)
|
196 | * ...
|
197 |
|
198 | ### aeButton
|
199 | A Button...
|
200 | Insert description about props needed and so on, example code and also add an image probably
|
201 |
|
202 | ### aeIdentity
|
203 | A Button...
|