adata-ui 0.1.4 → 0.1.8
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 +4464 -762
- package/dist/adata-ui.common.js.map +1 -1
- package/dist/adata-ui.css +1 -1
- package/dist/adata-ui.umd.js +4464 -762
- 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 +25791 -19991
- package/package.json +2 -1
- package/src/App.vue +23 -23
- package/src/components/Alert/Alert.vue +20 -20
- package/src/components/Button/BaseButton.vue +1 -1
- package/src/components/Footer/Footer.vue +2 -2
- package/src/components/Header/Header.stories.js +55 -0
- package/src/components/Header/Header.vue +284 -104
- package/src/components/Header/Profile.vue +806 -0
- package/src/components/PasswordField/PasswordField.stories.js +1 -1
- package/src/components/index.js +5 -2
- package/src/components/transitions/SlideToggle.vue +55 -0
- package/src/components/transitions/VerticalMobileToggle.vue +76 -0
- package/src/configs/navigationBarConfig.js +22 -0
- package/src/configs/profileDropDown.js +101 -0
- package/src/stories/Button.stories.js +46 -46
- package/src/stories/Button.vue +54 -54
- package/src/stories/Header.stories.js +21 -21
- package/src/stories/Header.vue +59 -59
- package/src/stories/Introduction.stories.mdx +211 -211
- package/src/stories/Page.stories.js +25 -25
- package/src/stories/Page.vue +88 -88
- package/src/stories/button.css +30 -30
- package/src/stories/header.css +26 -26
- package/src/stories/page.css +69 -69
|
@@ -3,7 +3,7 @@ import PasswordField from "./PasswordField.vue";
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'PasswordField',
|
|
5
5
|
component: PasswordField,
|
|
6
|
-
template: "<
|
|
6
|
+
template: "<password-field label='Example'></password-field>"
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const Template = (args, { argTypes }) => ({
|
package/src/components/index.js
CHANGED
|
@@ -3,12 +3,15 @@ import AButton from './Button/BaseButton'
|
|
|
3
3
|
import ATextField from './TextField/TextField'
|
|
4
4
|
import APasswordField from './PasswordField/PasswordField'
|
|
5
5
|
import AAlert from './Alert/Alert'
|
|
6
|
-
|
|
6
|
+
import AHeader from './Header/Header'
|
|
7
|
+
import AFooter from './Footer/Footer'
|
|
7
8
|
const Components = {
|
|
8
9
|
AButton,
|
|
9
10
|
ATextField,
|
|
10
11
|
APasswordField,
|
|
11
|
-
AAlert
|
|
12
|
+
AAlert,
|
|
13
|
+
AHeader,
|
|
14
|
+
AFooter
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
Object.keys(Components).forEach(name => {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition
|
|
3
|
+
v-on:before-enter="beforeEnter"
|
|
4
|
+
v-on:enter="enter"
|
|
5
|
+
v-on:after-enter="afterEnter"
|
|
6
|
+
v-on:before-leave="beforeLeave"
|
|
7
|
+
v-on:leave="leave"
|
|
8
|
+
v-on:after-leave="afterLeave"
|
|
9
|
+
>
|
|
10
|
+
<slot :animationClass="'slideToggleAnimation'" :compareNotificationClass="'compareNotification'"
|
|
11
|
+
:fastAnimation="'fastAnimation'"/>
|
|
12
|
+
</transition>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
methods: {
|
|
17
|
+
beforeEnter: function (el) {
|
|
18
|
+
el.style.height = "0";
|
|
19
|
+
el.style.overflow = "hidden";
|
|
20
|
+
},
|
|
21
|
+
enter: function (el) {
|
|
22
|
+
el.style.height = el.scrollHeight + "px";
|
|
23
|
+
},
|
|
24
|
+
afterEnter: function (el) {
|
|
25
|
+
el.style.height = "auto";
|
|
26
|
+
el.style.overflow = "initial";
|
|
27
|
+
},
|
|
28
|
+
beforeLeave: function (el) {
|
|
29
|
+
el.style.overflow = "hidden";
|
|
30
|
+
el.style.height = el.scrollHeight + "px";
|
|
31
|
+
el.scrollHeight;
|
|
32
|
+
},
|
|
33
|
+
leave: function (el) {
|
|
34
|
+
el.style.height = "0";
|
|
35
|
+
},
|
|
36
|
+
afterLeave: function (el) {
|
|
37
|
+
el.style.height = "auto";
|
|
38
|
+
el.style.overflow = "initial";
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
<style>
|
|
44
|
+
.slideToggleAnimation {
|
|
45
|
+
transition: 0.3s all;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.fastAnimation {
|
|
49
|
+
transition: 0.01s all;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.compareNotification {
|
|
53
|
+
transition: 3s all;
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition
|
|
3
|
+
v-on:before-enter="beforeEnter"
|
|
4
|
+
v-on:enter="enter"
|
|
5
|
+
v-on:after-enter="afterEnter"
|
|
6
|
+
v-on:before-leave="beforeLeave"
|
|
7
|
+
v-on:leave="leave"
|
|
8
|
+
v-on:after-leave="afterLeave"
|
|
9
|
+
>
|
|
10
|
+
<slot :animationClass="'slideToggleAnimation'" :compareNotificationClass="'compareNotification'" />
|
|
11
|
+
</transition>
|
|
12
|
+
</template>
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
props: {
|
|
16
|
+
zIndex: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 0
|
|
19
|
+
},
|
|
20
|
+
top: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "0%"
|
|
23
|
+
},
|
|
24
|
+
overflow: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "initial"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
beforeEnter: function (el) {
|
|
31
|
+
el.style.width = "0";
|
|
32
|
+
el.style.overflowX = "hidden";
|
|
33
|
+
el.style.overflowY = "hidden";
|
|
34
|
+
el.style.position = "fixed";
|
|
35
|
+
el.style.top = "0";
|
|
36
|
+
el.style.right = "0";
|
|
37
|
+
el.style.background = "#fff";
|
|
38
|
+
},
|
|
39
|
+
afterEnter: function (el) {
|
|
40
|
+
el.style.height = "100vh";
|
|
41
|
+
el.style.width = "100vw";
|
|
42
|
+
el.style.overflowX = "hidden";
|
|
43
|
+
el.style.overflowY = "auto";
|
|
44
|
+
el.style.position = "fixed";
|
|
45
|
+
el.style.top = this.top;
|
|
46
|
+
el.style.right = "0";
|
|
47
|
+
el.style.background = "#fff";
|
|
48
|
+
el.style.zIndex = (90 + this.zIndex).toString();
|
|
49
|
+
},
|
|
50
|
+
beforeLeave: function (el) {
|
|
51
|
+
el.style.overflow = "hidden";
|
|
52
|
+
el.style.width = el.scrollHeight + "px";
|
|
53
|
+
el.scrollHeight;
|
|
54
|
+
},
|
|
55
|
+
leave: function (el) {
|
|
56
|
+
el.style.width = "0";
|
|
57
|
+
},
|
|
58
|
+
afterLeave: function (el) {
|
|
59
|
+
el.style.position = "fixed";
|
|
60
|
+
el.style.top = "0";
|
|
61
|
+
el.style.right = "0";
|
|
62
|
+
el.style.width = "auto";
|
|
63
|
+
el.style.overflow = "initial";
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
</script>
|
|
68
|
+
<style>
|
|
69
|
+
.slideToggleAnimation {
|
|
70
|
+
transition: 0.3s all;
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
.compareNotification{
|
|
74
|
+
transition: 3s all;
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const menuList = [
|
|
2
|
+
{
|
|
3
|
+
id: 1,
|
|
4
|
+
name: "Контрагенты",
|
|
5
|
+
url: 'https://pk.adata.kz',
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
id: 2,
|
|
9
|
+
name: "Тендеры",
|
|
10
|
+
url: 'https://tender.adata.kz',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 3,
|
|
14
|
+
name: "Работа",
|
|
15
|
+
url: 'https://work.adata.kz',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 4,
|
|
19
|
+
name: "Штрафы",
|
|
20
|
+
url: 'https://fines.adata.kz',
|
|
21
|
+
}
|
|
22
|
+
];
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export const profileDropDown = [
|
|
2
|
+
{
|
|
3
|
+
id: 1,
|
|
4
|
+
name: "Общие настройки",
|
|
5
|
+
url: "https://adata.kz/profile?tab=general",
|
|
6
|
+
disabled: false
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
id: 2,
|
|
10
|
+
name: "Увеличить лимит запросов",
|
|
11
|
+
url: "https://adata.kz/profile?tab=tariffs",
|
|
12
|
+
disabled: false
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 3,
|
|
16
|
+
name: "Текущий баланс: 0 ₸",
|
|
17
|
+
url: "https://adata.kz/profile?tab=tariffs",
|
|
18
|
+
link: "Пополнить",
|
|
19
|
+
disabled: true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 4,
|
|
23
|
+
name: "Историй платежей",
|
|
24
|
+
url: "https://adata.kz/profile?tab=payments",
|
|
25
|
+
disabled: false
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 5,
|
|
29
|
+
name: "Контрагенты",
|
|
30
|
+
opened: false,
|
|
31
|
+
children: [
|
|
32
|
+
{
|
|
33
|
+
id: 8,
|
|
34
|
+
name: "Избранные",
|
|
35
|
+
url: "https://pk.adata.kz/profile/favorites"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 9,
|
|
39
|
+
name: "История просмотров",
|
|
40
|
+
url: "https://pk.adata.kz/profile/browsing-history"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
disabled: false
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 6,
|
|
47
|
+
name: "Работа",
|
|
48
|
+
opened: false,
|
|
49
|
+
children: [
|
|
50
|
+
{
|
|
51
|
+
id: 10,
|
|
52
|
+
name: "Профиль",
|
|
53
|
+
url: "https://work.adata.kz/profile/account"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 11,
|
|
57
|
+
name: "Создать резюме",
|
|
58
|
+
url: "https://work.adata.kz/user/create"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 12,
|
|
62
|
+
name: "Отклики",
|
|
63
|
+
url: "https://work.adata.kz/profile/application"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 13,
|
|
67
|
+
name: "Предложения",
|
|
68
|
+
url: "https://work.adata.kz/profile/offer"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
disabled: false
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 7,
|
|
75
|
+
name: "Тендеры",
|
|
76
|
+
opened: false,
|
|
77
|
+
children: [
|
|
78
|
+
{
|
|
79
|
+
id: 14,
|
|
80
|
+
name: "Поиск тендеров",
|
|
81
|
+
url: "https://tender.adata.kz/"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 15,
|
|
85
|
+
name: "Поиск договоров",
|
|
86
|
+
url: "https://tender.adata.kz/main/contracts"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 16,
|
|
90
|
+
name: "Планы закупок",
|
|
91
|
+
url: "https://tender.adata.kz/main/plans"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 17,
|
|
95
|
+
name: "Шаблоны поиска",
|
|
96
|
+
url: "https://tender.adata.kz/profile/search-profile"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
disabled: false
|
|
100
|
+
},
|
|
101
|
+
];
|
|
@@ -1,46 +1,46 @@
|
|
|
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
|
-
};
|
|
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
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
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
|
+
<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 +1,21 @@
|
|
|
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 = {};
|
|
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
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
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>
|
|
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>
|