Skip to content

Commit 7f5505e

Browse files
author
Jessica Peng
committedJan 28, 2022
install storybook eslint, add more doc
1 parent 1b0ac58 commit 7f5505e

File tree

11 files changed

+14267
-16882
lines changed

11 files changed

+14267
-16882
lines changed
 

‎.eslintrc.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module.exports = {
66
'extends': [
77
'eslint:recommended',
88
'plugin:vue/essential',
9-
'plugin:vue/strongly-recommended'
9+
'plugin:vue/strongly-recommended',
10+
'plugin:storybook/recommended'
1011
],
1112
'globals': {
1213
'Atomics': 'readonly',

‎package-lock.json

+11,017-12,670
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"eslint": "eslint --ignore-path .gitignore ."
2424
},
2525
"dependencies": {
26+
"@rollup/plugin-replace": "^2.3.4",
2627
"@vue/babel-preset-app": "^4.4.6",
2728
"all": "0.0.0",
2829
"bignumber.js": "^9.0.0",
@@ -33,7 +34,6 @@
3334
"git-url-parse": "^11.1.2",
3435
"material-design-icons-iconfont": "^5.0.1",
3536
"minimist": "^1.2.5",
36-
"@rollup/plugin-replace": "^2.3.4",
3737
"rollup-plugin-uglify-es": "0.0.1",
3838
"style-loader": "^1.2.1",
3939
"vue": "^2.6.10",
@@ -49,13 +49,11 @@
4949
"@babel/core": "^7.10.4",
5050
"@mdi/font": "^5.1.45",
5151
"@rollup/plugin-alias": "^3.1.1",
52+
"@rollup/plugin-buble": "0.21.3",
53+
"@rollup/plugin-commonjs": "17.1.0",
5254
"@rollup/plugin-image": "^2.0.5",
5355
"@rollup/plugin-node-resolve": "^7.1.3",
5456
"@rollup/plugin-url": "6.0.0",
55-
"@rollup/plugin-buble": "0.21.3",
56-
"@rollup/plugin-commonjs": "17.1.0",
57-
"rollup": "^2.3.0",
58-
"rollup-plugin-vue": "^5.0.1",
5957
"@storybook/addon-actions": "^5.3.17",
6058
"@storybook/addon-backgrounds": "^5.3.17",
6159
"@storybook/addon-docs": "^5.3.18",
@@ -75,11 +73,14 @@
7573
"babel-eslint": "^10.0.1",
7674
"babel-loader": "^8.0.6",
7775
"babel-preset-vue": "^2.0.2",
78-
"eslint": "5.16.0",
76+
"eslint": "^6.8.0",
7977
"eslint-plugin-prettier": "^3.1.4",
78+
"eslint-plugin-storybook": "^0.5.6",
8079
"eslint-plugin-vue": "^6.2.2",
8180
"file-loader": "^6.0.0",
8281
"prettier": "^1.18.2",
82+
"rollup": "^2.3.0",
83+
"rollup-plugin-vue": "^5.0.1",
8384
"sass-loader": "^7.0.2",
8485
"style-resources-loader": "^1.3.3",
8586
"vue-cli-plugin-vuetify": "^2.0.6",

‎src/components/MewCopy/MewCopy.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<template v-slot:activator="{ on }">
1414
<v-icon
1515
:small="isSmall"
16-
:class="['copy-icon cursor-pointer', color]"
16+
:class="['copy-icon cursor-pointer', className]"
1717
v-on="on"
1818
@click="copyToClipboard"
1919
>
@@ -47,14 +47,14 @@ export default {
4747
},
4848
props: {
4949
/**
50-
* Assigns the color of the icon. Accepts a text class color from mew-color.
50+
* Pass a class to change the icon color.
5151
*/
52-
color: {
52+
className: {
5353
type: String,
5454
default: 'basic--text'
5555
},
5656
/**
57-
* Makes the icon small.
57+
* Makes the icon smaller.
5858
*/
5959
isSmall: {
6060
type: Boolean,
@@ -68,14 +68,14 @@ export default {
6868
default: ''
6969
},
7070
/**
71-
* The tooltip text
71+
* The tooltip text.
7272
*/
7373
tooltip: {
7474
type: String,
7575
default: 'Copy'
7676
},
7777
/**
78-
* The toast text after successfully copying
78+
* The toast text after successfully copying.
7979
*/
8080
successToast: {
8181
type: String,

‎src/components/MewInput/MewInput.vue

+28-24
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,16 @@
3333
=====================================================================================
3434
-->
3535
<template v-slot:message="item">
36-
<span class="mew-label"
37-
>{{ item.message }}
36+
<span
37+
class="mew-label"
38+
>{{ item.message }}
3839
<a
3940
v-if="buyMoreStr"
4041
rel="noopener noreferrer"
4142
href="https://ccswap.myetherwallet.com/#/"
4243
target="_blank"
4344
class="mew-label"
44-
>{{ buyMoreStr }}</a
45-
></span
46-
>
45+
>{{ buyMoreStr }}</a></span>
4746
</template>
4847
<template v-slot:prepend-inner>
4948
<!--
@@ -74,7 +73,12 @@
7473
Mew Input: Token Image (displays at the beginning of the input)
7574
=====================================================================================
7675
-->
77-
<img v-if="image" height="30" :src="image" alt="token image" />
76+
<img
77+
v-if="image"
78+
height="30"
79+
:src="image"
80+
alt="token image"
81+
>
7882
</div>
7983
</template>
8084
<!--
@@ -106,12 +110,12 @@
106110
</template>
107111

108112
<script>
109-
import MewBlockie from "@/components/MewBlockie/MewBlockie.vue";
113+
import MewBlockie from '@/components/MewBlockie/MewBlockie.vue';
110114
111-
const types = ["password", "text"];
115+
const types = ['password', 'text'];
112116
113117
export default {
114-
name: "MewInput",
118+
name: 'MewInput',
115119
components: {
116120
MewBlockie,
117121
},
@@ -121,7 +125,7 @@ export default {
121125
*/
122126
errorMessages: {
123127
type: [String, Array],
124-
default: "",
128+
default: '',
125129
},
126130
/**
127131
* input is read only
@@ -156,21 +160,21 @@ export default {
156160
*/
157161
label: {
158162
type: String,
159-
default: "",
163+
default: '',
160164
},
161165
/**
162166
* The input placeholder.
163167
*/
164168
placeholder: {
165169
type: String,
166-
default: "",
170+
default: '',
167171
},
168172
/**
169173
* The input value.
170174
*/
171175
value: {
172176
type: String,
173-
default: "",
177+
default: '',
174178
},
175179
/**
176180
* The input id.
@@ -184,7 +188,7 @@ export default {
184188
*/
185189
rightLabel: {
186190
type: String,
187-
default: "",
191+
default: '',
188192
},
189193
/**
190194
* Hides input clear functionality. Clear symbol will be displayed on the right side.
@@ -207,7 +211,7 @@ export default {
207211
*/
208212
resolvedAddr: {
209213
type: String,
210-
default: "",
214+
default: '',
211215
},
212216
/**
213217
* Enables persistent hint
@@ -221,7 +225,7 @@ export default {
221225
*/
222226
hint: {
223227
type: String,
224-
default: "",
228+
default: '',
225229
},
226230
/**
227231
* Displays search input
@@ -235,21 +239,21 @@ export default {
235239
*/
236240
type: {
237241
type: String,
238-
default: "text",
242+
default: 'text',
239243
},
240244
/**
241245
* Prepends an image in the input
242246
*/
243247
image: {
244248
type: String,
245-
default: "",
249+
default: '',
246250
},
247251
/**
248252
* Adds a "Buy more" string to the end of the first index of the errorMessages prop.
249253
*/
250254
buyMoreStr: {
251255
type: String,
252-
default: "",
256+
default: '',
253257
},
254258
/**
255259
* Object for max button, i.e. {title: 'Max', disabled: false, method: () => {}}
@@ -278,14 +282,14 @@ export default {
278282
},
279283
data() {
280284
return {
281-
inputValue: "",
285+
inputValue: '',
282286
showPassword: false,
283287
};
284288
},
285289
watch: {
286290
inputValue(newVal, oldVal) {
287291
if (newVal !== oldVal) {
288-
this.$emit("input", newVal, this.id);
292+
this.$emit('input', newVal, this.id);
289293
}
290294
},
291295
value(newVal, oldVal) {
@@ -300,9 +304,9 @@ export default {
300304
},
301305
showPasswordIcon() {
302306
if (this.isPasswordType && !this.hidePasswordIcon) {
303-
return !this.showPassword ? "mdi-eye" : "mdi-eye-off";
307+
return !this.showPassword ? 'mdi-eye' : 'mdi-eye-off';
304308
}
305-
return "";
309+
return '';
306310
},
307311
inputType() {
308312
if (this.isPasswordType && this.showPassword) {
@@ -321,7 +325,7 @@ export default {
321325
}
322326
},
323327
clear(val) {
324-
this.inputValue = val ? val : "";
328+
this.inputValue = val ? val : '';
325329
},
326330
},
327331
};

‎src/components/MewMenu/MewMenu.vue

+21-12
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,25 @@
2121
v-on="on"
2222
>
2323
{{ listObj.name }}
24-
<v-icon v-if="!isMenuOpen" :class="['title', activatorTextColor]"
25-
>mdi-chevron-down</v-icon
26-
>
27-
<v-icon v-if="isMenuOpen" :class="['title', activatorTextColor]"
28-
>mdi-chevron-up</v-icon
29-
>
24+
<v-icon
25+
v-if="!isMenuOpen"
26+
:class="['title', activatorTextColor]"
27+
>mdi-chevron-down</v-icon>
28+
<v-icon
29+
v-if="isMenuOpen"
30+
:class="['title', activatorTextColor]"
31+
>mdi-chevron-up</v-icon>
3032
</span>
3133
</template>
3234
<!--
3335
=====================================================================================
3436
Menu List Content
3537
=====================================================================================
3638
-->
37-
<v-list v-for="(item, index) in listObj.items" :key="index">
39+
<v-list
40+
v-for="(item, index) in listObj.items"
41+
:key="index"
42+
>
3843
<!--
3944
=====================================================================================
4045
slot: 'mewMenuItem' + menu item number
@@ -55,7 +60,11 @@
5560
<v-list-item-title
5661
class="mew-body basic--text subItem d-flex align-center"
5762
>
58-
<v-icon v-if="subItem.iconName" class="mr-1 basic--text" size="14px">
63+
<v-icon
64+
v-if="subItem.iconName"
65+
class="mr-1 basic--text"
66+
size="14px"
67+
>
5968
{{ subItem.iconName }}
6069
</v-icon>
6170
{{ subItem.title }}
@@ -67,7 +76,7 @@
6776

6877
<script>
6978
export default {
70-
name: "MewMenu",
79+
name: 'MewMenu',
7180
data() {
7281
return {
7382
isMenuOpen: false,
@@ -90,17 +99,17 @@ export default {
9099
*/
91100
activatorTextColor: {
92101
type: String,
93-
default: "basic--text",
102+
default: 'basic--text',
94103
},
95104
},
96105
computed: {
97106
contentClasses() {
98-
return "mew-menu-content elevation-2 ";
107+
return 'mew-menu-content elevation-2 ';
99108
},
100109
},
101110
methods: {
102111
goTo(link) {
103-
this.$emit("goToPage", link);
112+
this.$emit('goToPage', link);
104113
},
105114
},
106115
};

‎stories/GlobalStorybook.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* styles used to set the height of the component preview for documentation purposes.
2+
* styles used to set the height of the preview component for documentation purposes.
33
*/
44
#story--mewtooltip--mew-tooltip,
55
#story--mewsuperbutton--mew-super-button,
@@ -17,7 +17,7 @@
1717
#story--mewtransformhash--mew-transform-hash,
1818
#story--mewaddressselect--mew-address-select,
1919
#story--mewalert--mew-alert,
20-
#story--mewcopy--mew-copy
20+
#story--mewdropdown--mew-dropdown
2121
{
2222
.v-application {
2323
height: 250px;

‎stories/MewCopy/MewCopy.mdx

+3-7
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@ import { Story, Preview, Props } from '@storybook/addon-docs/blocks';
33
import MewCopy from '@/components/MewCopy/MewCopy.vue';
44
import './../GlobalStorybook.scss'
55

6-
# MEW Copy Container
6+
# MEW Copy
77
`<mew-copy />`
88

99
## Overview
10-
The mew-copy component provides a way for users to copy specific values to their clipboard.
11-
There is a slot called **contentSlot** that can be used to place customizable content to the right of the box. There is an option to change
12-
the color of the label text by passing a class through the **className** prop. There is an **id** prop that is mainly used to distinguish each
13-
copy for when
14-
mew-copy is found in a loop. When the copy is set, there is an event called **input** that will be emitted with the value and id as the params.
15-
## Props
10+
The mew-copy component provides a way for users to copy specific values to their clipboard. You can control the icon color by passing
11+
a class to the **className** prop. Must pass the value you would like to copy to the **copyValue** prop.
1612
<Props of={MewCopy} />
1713
<Preview><Story id="mewcopy--mew-copy" /></Preview>
1814

0 commit comments

Comments
 (0)
Please sign in to comment.