adata-ui 0.1.12 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adata-ui.common.js +1886 -34
- package/dist/adata-ui.common.js.map +1 -1
- package/dist/adata-ui.css +1 -1
- package/dist/adata-ui.umd.js +1886 -34
- package/dist/adata-ui.umd.js.map +1 -1
- package/dist/adata-ui.umd.min.js +1 -1
- package/dist/adata-ui.umd.min.js.map +1 -1
- package/package-lock.json +1065 -136
- package/package.json +3 -1
- package/public/index.html +2 -2
- package/public/logo.svg +4 -0
- package/src/components/Alert/Alert.stories.js +5 -5
- package/src/components/Button/Button.stories.js +6 -6
- package/src/components/Footer/Footer.stories.js +5 -5
- package/src/components/Footer/Footer.vue +5 -5
- package/src/components/Header/Header.stories.js +8 -7
- package/src/components/Header/Header.vue +9 -8
- package/src/components/Header/Profile.vue +29 -8
- package/src/components/Introduction.stories.mdx +7 -0
- package/src/components/PasswordField/PasswordField.stories.js +5 -5
- package/src/components/TextField/TextField.stories.js +5 -5
- package/src/stories/Button.stories.js +0 -46
- package/src/stories/Button.vue +0 -54
- package/src/stories/Header.stories.js +0 -21
- package/src/stories/Header.vue +0 -59
- package/src/stories/Introduction.stories.mdx +0 -211
- package/src/stories/Page.stories.js +0 -25
- package/src/stories/Page.vue +0 -88
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -26
- package/src/stories/page.css +0 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adata-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"test": "jest"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
+
"@storybook/addons": "^6.4.14",
|
|
16
|
+
"@storybook/theming": "^6.4.14",
|
|
15
17
|
"core-js": "^3.6.5",
|
|
16
18
|
"node-sass": "^5.0.0",
|
|
17
19
|
"user": "0.0.0",
|
package/public/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
-
<link rel="icon" href="<%= BASE_URL %>
|
|
8
|
-
<title
|
|
7
|
+
<link rel="icon" href="<%= BASE_URL %>logo.svg">
|
|
8
|
+
<title>Adata UI</title>
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<noscript>
|
package/public/logo.svg
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="40" height="38" viewBox="0 0 28 26" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M13.3117 8.26147H13.2237C13.1861 8.71085 13.0938 9.15443 12.9487 9.58314L11.231 14.7333H15.2706L13.5754 9.63513C13.4383 9.18726 13.3499 8.7269 13.3117 8.26147Z" fill="#2C3E50"/>
|
|
3
|
+
<path d="M24.3463 0H2.70514C1.98769 0 1.29963 0.273926 0.792318 0.76152C0.285006 1.24911 0 1.91044 0 2.6V23.4C0 24.0896 0.285006 24.7509 0.792318 25.2385C1.29963 25.7261 1.98769 26 2.70514 26H24.3463C25.0637 26 25.7518 25.7261 26.2591 25.2385C26.7664 24.7509 27.0514 24.0896 27.0514 23.4V2.6C27.0514 1.91044 26.7664 1.24911 26.2591 0.76152C25.7518 0.273926 25.0637 0 24.3463 0ZM17.2069 20.7242L16.0798 17.3485H10.4666L9.35527 20.7242H5.50721L11.2534 5.55751H15.4689L21.0821 20.7242H17.2069Z" fill="#2C3E50"/>
|
|
4
|
+
</svg>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AAlert from './Alert.vue'
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Alert',
|
|
5
|
-
component:
|
|
6
|
-
template: '<alert>button</alert>'
|
|
5
|
+
component: AAlert,
|
|
6
|
+
template: '<a-alert>button</a-alert>'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const Template = (args, { argTypes }) => ({
|
|
10
|
-
components: {
|
|
10
|
+
components: { AAlert },
|
|
11
11
|
props: Object.keys(argTypes),
|
|
12
|
-
template: '<alert v-bind="$props">Alert</alert>'
|
|
12
|
+
template: '<a-alert v-bind="$props">Alert</a-alert>'
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
export const Info = Template.bind({})
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AButton from './BaseButton.vue'
|
|
2
2
|
import { action } from "@storybook/addon-actions"
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title: '
|
|
6
|
-
component:
|
|
7
|
-
template: '<
|
|
5
|
+
title: 'Button',
|
|
6
|
+
component: AButton,
|
|
7
|
+
template: '<a-button>Button</a-button>'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const Template = (args, { argTypes }) => ({
|
|
11
|
-
components: {
|
|
11
|
+
components: { AButton },
|
|
12
12
|
props: Object.keys(argTypes),
|
|
13
|
-
template: '<
|
|
13
|
+
template: '<a-button @click="action" v-bind="$props">Button</a-button>',
|
|
14
14
|
methods: {
|
|
15
15
|
action: action('click')
|
|
16
16
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AFooter from './Footer.vue'
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Footer',
|
|
5
|
-
component:
|
|
6
|
-
template: '<
|
|
5
|
+
component: AFooter,
|
|
6
|
+
template: '<a-footer></a-footer>'
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
const Template = (args, { argTypes }) => ({
|
|
10
|
-
components: {
|
|
10
|
+
components: { AFooter },
|
|
11
11
|
props: Object.keys(argTypes),
|
|
12
|
-
template: '<
|
|
12
|
+
template: '<a-footer v-bind="$props"></a-footer>'
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const MainFooter = Template.bind({});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<footer class="footer" :class="[{'paddinged': hasBottomMenu}]">
|
|
3
|
-
<div class="footer__top">
|
|
2
|
+
<footer class="a-footer" :class="[{'paddinged': hasBottomMenu}]">
|
|
3
|
+
<div class="a-footer__top">
|
|
4
4
|
<ul class="nav">
|
|
5
5
|
<a class="logo adata-logo" href="https://adata.kz">
|
|
6
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 166 48">
|
|
6
|
+
<svg fill="#2C3E50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 166 48">
|
|
7
7
|
<path d="M62.926 38.22v-28h10.316c10.342 0 15.511 4.55 15.508 13.652 0 4.36-1.41 7.843-4.232 10.448-2.822 2.605-6.58 3.907-11.276 3.904l-10.316-.004zm6.56-22.868v17.752h3.248c2.839 0 5.069-.82 6.69-2.46 1.622-1.64 2.43-3.873 2.424-6.7 0-2.667-.8-4.767-2.403-6.3-1.602-1.533-3.853-2.297-6.752-2.292h-3.206zM118.5 38.22h-7.131l-2.079-6.228H98.958l-2.079 6.228h-7.093l10.598-28h7.775l10.341 28zm-10.723-11.072l-3.127-9.416a11.94 11.94 0 01-.486-2.516h-.162c-.07.83-.24 1.649-.508 2.44l-3.168 9.492h7.451zm31.833-11.796h-8.316V38.22h-6.557V15.352h-8.274v-5.136h23.147v5.136zM166 38.22h-7.143l-2.079-6.228h-10.349l-2.05 6.228h-7.106l10.598-28h7.776l10.353 28zm-10.719-11.072l-3.127-9.416a11.94 11.94 0 01-.486-2.516h-.163c-.069.83-.239 1.649-.507 2.44l-3.168 9.492h7.451zM24.553 15.252h-.163c-.069.83-.24 1.649-.507 2.44L20.715 27.2h7.45l-3.126-9.412a12.02 12.02 0 01-.486-2.536z"></path>
|
|
8
8
|
<path d="M44.905 0H4.99a5.091 5.091 0 00-3.528 1.406A4.71 4.71 0 000 4.8v38.4a4.71 4.71 0 001.461 3.394A5.091 5.091 0 004.99 48h39.916a5.091 5.091 0 003.528-1.406 4.71 4.71 0 001.462-3.394V4.8a4.71 4.71 0 00-1.462-3.394A5.091 5.091 0 0044.905 0zM31.737 38.26l-2.079-6.232H19.305l-2.05 6.232h-7.097l10.598-28h7.776l10.353 28h-7.148z"></path>
|
|
9
9
|
</svg>
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</li>
|
|
50
50
|
</ul>
|
|
51
51
|
</div>
|
|
52
|
-
<div class="footer__bottom"><span>2022 © ТОО "Alldata"</span></div>
|
|
52
|
+
<div class="a-footer__bottom"><span>2022 © ТОО "Alldata"</span></div>
|
|
53
53
|
</footer>
|
|
54
54
|
</template>
|
|
55
55
|
|
|
@@ -82,7 +82,7 @@ a {
|
|
|
82
82
|
padding: 0;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
.footer {
|
|
85
|
+
.a-footer {
|
|
86
86
|
background: #BDC7CE4C;
|
|
87
87
|
font-size: 14px;
|
|
88
88
|
margin-top: 20px;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AHeader from './Header.vue'
|
|
2
2
|
import {action} from "@storybook/addon-actions";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Header',
|
|
6
|
-
component:
|
|
7
|
-
template: '<
|
|
6
|
+
component: AHeader,
|
|
7
|
+
template: '<a-header></a-header>'
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const Template = (args, { argTypes }) => ({
|
|
11
|
-
components: {
|
|
11
|
+
components: { AHeader },
|
|
12
12
|
props: Object.keys(argTypes),
|
|
13
|
-
template: '<
|
|
13
|
+
template: '<a-header @menuOpen="openMenu' +
|
|
14
14
|
'" @showBalanceModal="showBalance"' +
|
|
15
15
|
' @setShowModal="showModal"' +
|
|
16
16
|
' @logout="logoutClick"' +
|
|
17
17
|
' @setIsReplenishModal="setReplenishModal" v-bind="$props"' +
|
|
18
|
-
'></
|
|
18
|
+
'></a-header>',
|
|
19
19
|
methods: {
|
|
20
20
|
openMenu(val) {
|
|
21
21
|
console.log(val);
|
|
22
22
|
},
|
|
23
23
|
showBalance(val) {
|
|
24
24
|
console.log(val);
|
|
25
|
+
console.log(val);
|
|
25
26
|
},
|
|
26
27
|
showModal(val) {
|
|
27
28
|
console.log(val);
|
|
@@ -50,6 +51,6 @@ headerAuthenticated.args = {
|
|
|
50
51
|
daysRemaining: "остаток дней: 29",
|
|
51
52
|
email: "sboranbayeva@gmail.com",
|
|
52
53
|
loginUrl: "https://id.adtdev.kz/auth/signin?url=https://pk.adata.kz/auth",
|
|
53
|
-
activeTabKey: '
|
|
54
|
+
activeTabKey: 'tender',
|
|
54
55
|
balance: 1954900
|
|
55
56
|
}
|
|
@@ -9,19 +9,18 @@
|
|
|
9
9
|
</svg>
|
|
10
10
|
</a>
|
|
11
11
|
<div class="menu" v-if="subheaderItems.length > 0">
|
|
12
|
-
<
|
|
12
|
+
<a v-for="(item, index) in subheaderItems"
|
|
13
13
|
:key="index"
|
|
14
14
|
class="menu__wrapper menu__items"
|
|
15
|
-
:class="{active: locationUrl.includes(item.url)}"
|
|
16
|
-
|
|
15
|
+
:class="{active: locationUrl.includes(toAdtdev(item.url))}"
|
|
16
|
+
:href="item.url"
|
|
17
17
|
>
|
|
18
18
|
{{ item.name }}
|
|
19
|
-
</
|
|
19
|
+
</a>
|
|
20
20
|
</div>
|
|
21
21
|
</div>
|
|
22
22
|
<div class="a-header__right">
|
|
23
23
|
<slot name="chooseCountry"></slot>
|
|
24
|
-
<slot name="profile"></slot>
|
|
25
24
|
<Profile
|
|
26
25
|
v-bind:profileDropDown="profileDropDown"
|
|
27
26
|
:isDev="isDev"
|
|
@@ -30,6 +29,7 @@
|
|
|
30
29
|
:daysRemaining="daysRemaining"
|
|
31
30
|
:email="email"
|
|
32
31
|
:loginUrl="loginUrl"
|
|
32
|
+
:activeTabKey="activeTabKey"
|
|
33
33
|
@showBalanceModal="(val) => { $emit('showBalanceModal', val) }"
|
|
34
34
|
@setShowModal="(val) => { $emit('setShowModal', val) }"
|
|
35
35
|
@logout="$emit('logout')"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
v-for="(item, index) in subheaderItems"
|
|
64
64
|
:key="index"
|
|
65
65
|
class="menu_mobile-wrapper"
|
|
66
|
-
:class="{'active-burger-tab': locationUrl.includes(item.url)}"
|
|
66
|
+
:class="{'active-burger-tab': locationUrl.includes(toAdtdev(item.url))}"
|
|
67
67
|
@click="handleClick(item.url)"
|
|
68
68
|
>
|
|
69
69
|
{{ item.name }}
|
|
@@ -120,7 +120,8 @@ export default {
|
|
|
120
120
|
},
|
|
121
121
|
activeTabKey: {
|
|
122
122
|
type: String,
|
|
123
|
-
default:
|
|
123
|
+
default: "",
|
|
124
|
+
required: true
|
|
124
125
|
},
|
|
125
126
|
balance: {
|
|
126
127
|
type: Number,
|
|
@@ -180,7 +181,7 @@ export default {
|
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
.a-header {
|
|
183
|
-
width:
|
|
184
|
+
width: 100vw;
|
|
184
185
|
background: #ffffff;
|
|
185
186
|
max-height: 62px;
|
|
186
187
|
height: 62px;
|
|
@@ -51,13 +51,14 @@
|
|
|
51
51
|
<div :class="elem.link ? 'profile-menu__balance-link': 'profile-menu__links'"
|
|
52
52
|
class="gray-text"
|
|
53
53
|
v-if="elem.url"
|
|
54
|
-
@click="handleClick(elem.url, elem.name)"
|
|
54
|
+
@click="handleClick(elem.url, elem.name)"
|
|
55
|
+
>
|
|
55
56
|
<div>
|
|
56
57
|
{{ elem.name }}
|
|
57
58
|
</div>
|
|
58
59
|
<span
|
|
59
60
|
v-if="elem.link"
|
|
60
|
-
@click="
|
|
61
|
+
@click="showModal(elem.url, elem.name)"
|
|
61
62
|
class="profile-menu__balance"
|
|
62
63
|
>
|
|
63
64
|
{{ elem.link }}
|
|
@@ -268,6 +269,11 @@ export default {
|
|
|
268
269
|
type: String,
|
|
269
270
|
default: "",
|
|
270
271
|
required: true
|
|
272
|
+
},
|
|
273
|
+
activeTabKey: {
|
|
274
|
+
type: String,
|
|
275
|
+
default: "",
|
|
276
|
+
required: true
|
|
271
277
|
}
|
|
272
278
|
},
|
|
273
279
|
components: {
|
|
@@ -287,6 +293,14 @@ export default {
|
|
|
287
293
|
if (this.profileDropDown && this.profileDropDown.length > 0) {
|
|
288
294
|
this.listDropDown = [...this.profileDropDown]
|
|
289
295
|
}
|
|
296
|
+
if(this.activeTabKey === 'counterparty') {
|
|
297
|
+
this.chosenElem = this.listDropDown.find(el => el.name === 'Контрагенты');
|
|
298
|
+
} else if (this.activeTabKey === 'tender') {
|
|
299
|
+
this.chosenElem = this.listDropDown.find(el => el.name === 'Тендеры');
|
|
300
|
+
} else if (this.activeTabKey === 'work') {
|
|
301
|
+
this.chosenElem = this.listDropDown.find(el => el.name === 'Работа');
|
|
302
|
+
}
|
|
303
|
+
this.chosenElem.opened = true;
|
|
290
304
|
},
|
|
291
305
|
computed: {
|
|
292
306
|
someMobileOpened() {
|
|
@@ -300,15 +314,22 @@ export default {
|
|
|
300
314
|
logout() {
|
|
301
315
|
this.$emit("logout");
|
|
302
316
|
},
|
|
303
|
-
|
|
317
|
+
async showModal(url, name) {
|
|
304
318
|
if (name.includes('Текущий')) {
|
|
319
|
+
if(window.location.href.includes(this.toAdtdev(url))) {
|
|
320
|
+
this.$emit("setIsReplenishModal", true);
|
|
321
|
+
this.setShowModal(true);
|
|
322
|
+
} else {
|
|
323
|
+
await window.open(this.toAdtdev(url) + "&modal=show", "_self")
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
handleClick(url, name) {
|
|
328
|
+
if (!name.includes('Текущий')) {
|
|
305
329
|
window.open(this.toAdtdev(url), "_self");
|
|
306
|
-
this
|
|
307
|
-
|
|
308
|
-
window.open(this.toAdtdev(url), "_self");
|
|
330
|
+
this.active = false;
|
|
331
|
+
if (this.chosenElem) this.chosenElem.opened = false;
|
|
309
332
|
}
|
|
310
|
-
this.active = false;
|
|
311
|
-
if (this.chosenElem) this.chosenElem.opened = false;
|
|
312
333
|
},
|
|
313
334
|
rotateItem(index) {
|
|
314
335
|
this.chosenElem = this.listDropDown[index];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import APasswordField from "./PasswordField.vue";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'PasswordField',
|
|
5
|
-
component:
|
|
6
|
-
template: "<password-field label='Example'></password-field>"
|
|
5
|
+
component: APasswordField,
|
|
6
|
+
template: "<a-password-field label='Example'></a-password-field>"
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const Template = (args, { argTypes }) => ({
|
|
10
|
-
components: {
|
|
10
|
+
components: { APasswordField },
|
|
11
11
|
props: Object.keys(argTypes),
|
|
12
|
-
template: '<password-field v-bind="$props"></password-field>'
|
|
12
|
+
template: '<a-password-field v-bind="$props"></a-password-field>'
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
export const BasePasswordField = Template.bind({});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ATextField from "./TextField.vue";
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'TextField',
|
|
5
|
-
component:
|
|
5
|
+
component: ATextField,
|
|
6
6
|
data: () => ({ value: "" }),
|
|
7
|
-
template: "<text-field @input='(val) => {this.value = val}' label='Example'></text-field>>"
|
|
7
|
+
template: "<a-text-field @input='(val) => {this.value = val}' label='Example'></a-text-field>>"
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const Template = (args, { argTypes }) => ({
|
|
11
|
-
components: {
|
|
11
|
+
components: { ATextField },
|
|
12
12
|
props: Object.keys(argTypes),
|
|
13
|
-
template: '<text-field v-bind="$props"></text-field>'
|
|
13
|
+
template: '<a-text-field v-bind="$props"></a-text-field>'
|
|
14
14
|
})
|
|
15
15
|
|
|
16
16
|
export const Clearable = Template.bind({});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import MyButton from './Button.vue';
|
|
2
|
-
|
|
3
|
-
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Example/Button',
|
|
6
|
-
component: MyButton,
|
|
7
|
-
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
8
|
-
argTypes: {
|
|
9
|
-
backgroundColor: { control: 'color' },
|
|
10
|
-
size: {
|
|
11
|
-
control: { type: 'select' },
|
|
12
|
-
options: ['small', 'medium', 'large'],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
|
|
18
|
-
const Template = (args, { argTypes }) => ({
|
|
19
|
-
props: Object.keys(argTypes),
|
|
20
|
-
components: { MyButton },
|
|
21
|
-
template: '<my-button @onClick="onClick" v-bind="$props" />',
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const Primary = Template.bind({});
|
|
25
|
-
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
|
26
|
-
Primary.args = {
|
|
27
|
-
primary: true,
|
|
28
|
-
label: 'Button',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const Secondary = Template.bind({});
|
|
32
|
-
Secondary.args = {
|
|
33
|
-
label: 'Button',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const Large = Template.bind({});
|
|
37
|
-
Large.args = {
|
|
38
|
-
size: 'large',
|
|
39
|
-
label: 'Button',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const Small = Template.bind({});
|
|
43
|
-
Small.args = {
|
|
44
|
-
size: 'small',
|
|
45
|
-
label: 'Button',
|
|
46
|
-
};
|
package/src/stories/Button.vue
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button type="button" :class="classes" @click="onClick" :style="style">{{ label }}</button>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import './button.css';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
name: 'my-button',
|
|
10
|
-
|
|
11
|
-
props: {
|
|
12
|
-
label: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
primary: {
|
|
17
|
-
type: Boolean,
|
|
18
|
-
default: false,
|
|
19
|
-
},
|
|
20
|
-
size: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: 'medium',
|
|
23
|
-
validator: function (value) {
|
|
24
|
-
return ['small', 'medium', 'large'].indexOf(value) !== -1;
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
backgroundColor: {
|
|
28
|
-
type: String,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
computed: {
|
|
33
|
-
classes() {
|
|
34
|
-
return {
|
|
35
|
-
'storybook-button': true,
|
|
36
|
-
'storybook-button--primary': this.primary,
|
|
37
|
-
'storybook-button--secondary': !this.primary,
|
|
38
|
-
[`storybook-button--${this.size}`]: true,
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
style() {
|
|
42
|
-
return {
|
|
43
|
-
backgroundColor: this.backgroundColor,
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
methods: {
|
|
49
|
-
onClick() {
|
|
50
|
-
this.$emit('onClick');
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
</script>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import MyHeader from './Header';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Example/Header',
|
|
5
|
-
component: MyHeader,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const Template = (args, { argTypes }) => ({
|
|
9
|
-
props: Object.keys(argTypes),
|
|
10
|
-
components: { MyHeader },
|
|
11
|
-
template:
|
|
12
|
-
'<my-header :user="user" @onLogin="onLogin" @onLogout="onLogout" @onCreateAccount="onCreateAccount" />',
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const LoggedIn = Template.bind({});
|
|
16
|
-
LoggedIn.args = {
|
|
17
|
-
user: {},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const LoggedOut = Template.bind({});
|
|
21
|
-
LoggedOut.args = {};
|
package/src/stories/Header.vue
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<header>
|
|
3
|
-
<div class="wrapper">
|
|
4
|
-
<div>
|
|
5
|
-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
-
<g fill="none" fill-rule="evenodd">
|
|
7
|
-
<path
|
|
8
|
-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
9
|
-
fill="#FFF"
|
|
10
|
-
/>
|
|
11
|
-
<path
|
|
12
|
-
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
13
|
-
fill="#555AB9"
|
|
14
|
-
/>
|
|
15
|
-
<path
|
|
16
|
-
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
|
17
|
-
fill="#91BAF8"
|
|
18
|
-
/>
|
|
19
|
-
</g>
|
|
20
|
-
</svg>
|
|
21
|
-
<h1>Acme</h1>
|
|
22
|
-
</div>
|
|
23
|
-
<div>
|
|
24
|
-
<my-button size="small" @onClick="onLogout" label="Log out" v-if="user" />
|
|
25
|
-
<my-button size="small" @onClick="onLogin" label="Log in" v-if="!user" />
|
|
26
|
-
<my-button primary size="small" @onClick="onCreateAccount" label="Sign up" v-if="!user" />
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
</header>
|
|
30
|
-
</template>
|
|
31
|
-
|
|
32
|
-
<script>
|
|
33
|
-
import './header.css';
|
|
34
|
-
import MyButton from './Button.vue';
|
|
35
|
-
|
|
36
|
-
export default {
|
|
37
|
-
name: 'my-header',
|
|
38
|
-
|
|
39
|
-
components: { MyButton },
|
|
40
|
-
|
|
41
|
-
props: {
|
|
42
|
-
user: {
|
|
43
|
-
type: Object,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
methods: {
|
|
48
|
-
onLogin() {
|
|
49
|
-
this.$emit('onLogin');
|
|
50
|
-
},
|
|
51
|
-
onLogout() {
|
|
52
|
-
this.$emit('onLogout');
|
|
53
|
-
},
|
|
54
|
-
onCreateAccount() {
|
|
55
|
-
this.$emit('onCreateAccount');
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
</script>
|