adata-ui 0.1.2 → 0.1.3
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/README.md +3 -20
- package/dist/adata-ui.common.js +558 -72
- package/dist/adata-ui.common.js.map +1 -1
- package/dist/adata-ui.css +1 -1
- package/dist/adata-ui.umd.js +558 -72
- 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 +8132 -241
- package/package.json +19 -3
- package/src/App.vue +1 -6
- package/src/components/Alert/Alert.stories.js +17 -0
- package/src/components/Alert/Alert.vue +61 -0
- package/src/components/Button/BaseButton.vue +241 -0
- package/src/components/Button/Button.stories.js +16 -0
- package/src/components/PasswordField/PasswordField.stories.js +16 -0
- package/src/components/PasswordField/PasswordField.vue +68 -0
- package/src/components/TextField/TextField.stories.js +16 -0
- package/src/components/TextField/TextField.vue +355 -0
- package/src/components/index.js +8 -4
- package/src/stories/Button.stories.js +46 -0
- package/src/stories/Button.vue +54 -0
- package/src/stories/Header.stories.js +21 -0
- package/src/stories/Header.vue +59 -0
- package/src/stories/Introduction.stories.mdx +211 -0
- package/src/stories/Page.stories.js +25 -0
- package/src/stories/Page.vue +88 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +26 -0
- package/src/stories/page.css +69 -0
- package/src/components/Button.vue +0 -18
- package/src/components/HelloWorld.vue +0 -58
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="adt-text-block">
|
|
3
|
+
<div class="adt-text-block__field">
|
|
4
|
+
<input
|
|
5
|
+
v-if="!mask"
|
|
6
|
+
ref="input"
|
|
7
|
+
:type="type"
|
|
8
|
+
:value="value"
|
|
9
|
+
:placeholder="placeholder"
|
|
10
|
+
required
|
|
11
|
+
@input="$emit('input', $event.target.value)"
|
|
12
|
+
class="adt-text-block__input"
|
|
13
|
+
:class="{ error: !!errorText }"
|
|
14
|
+
/>
|
|
15
|
+
<TheMask
|
|
16
|
+
v-else
|
|
17
|
+
ref="maskInput"
|
|
18
|
+
:value="value"
|
|
19
|
+
:mask="mask"
|
|
20
|
+
:type="type"
|
|
21
|
+
:masked="false"
|
|
22
|
+
:placeholder="inputPlaceholder"
|
|
23
|
+
required
|
|
24
|
+
@input.native="$emit('input', $event.target.value)"
|
|
25
|
+
@focus.native="showPlaceholder = true"
|
|
26
|
+
@blur.native="showPlaceholder = false"
|
|
27
|
+
class="adt-text-block__input"
|
|
28
|
+
:class="{ error: !!errorText }"
|
|
29
|
+
/>
|
|
30
|
+
<label class="adt-text-block__label">{{ label }}<span v-if="required" class="adt-text-block__required">*</span></label>
|
|
31
|
+
<div class="adt-text-block__icon desktop" v-if="clearable && value && value.length > 0" @click="$emit('input', '')">
|
|
32
|
+
<svg width="12" height="12" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="clearIcon">
|
|
33
|
+
<path d="M2 2l12 12m0-12L2 14" stroke="#2C3E50" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
34
|
+
</svg>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="adt-text-block__error" v-if="!!errorText">
|
|
38
|
+
{{ errorText }}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
import { TheMask } from 'vue-the-mask';
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
name: "TextField",
|
|
48
|
+
props: {
|
|
49
|
+
errorText: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: ""
|
|
52
|
+
},
|
|
53
|
+
label: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
type: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "text",
|
|
60
|
+
},
|
|
61
|
+
mask: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: ""
|
|
64
|
+
},
|
|
65
|
+
value: {
|
|
66
|
+
type: [String, null],
|
|
67
|
+
required: true,
|
|
68
|
+
},
|
|
69
|
+
placeholder: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: ""
|
|
72
|
+
},
|
|
73
|
+
clearable: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
required: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
components: {
|
|
83
|
+
TheMask
|
|
84
|
+
},
|
|
85
|
+
data() {
|
|
86
|
+
return {
|
|
87
|
+
showPlaceholder: false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
computed: {
|
|
91
|
+
inputPlaceholder() {
|
|
92
|
+
return this.showPlaceholder ? this.placeholder : ""
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<style lang="scss">
|
|
99
|
+
*:focus {
|
|
100
|
+
outline: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.adt-text-block {
|
|
104
|
+
$self: &;
|
|
105
|
+
position: relative;
|
|
106
|
+
width: 100%;
|
|
107
|
+
|
|
108
|
+
&.magnifier {
|
|
109
|
+
#{$self}__input {
|
|
110
|
+
padding: 19px 40px 5px 40px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
#{$self}__label {
|
|
114
|
+
left: 40px;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&.magnifier-mobile {
|
|
119
|
+
#{$self}__magnifier {
|
|
120
|
+
display: block;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#{$self}__input {
|
|
124
|
+
padding: 19px 8px 5px 11px;
|
|
125
|
+
border-top-right-radius: 0;
|
|
126
|
+
border-bottom-right-radius: 0;
|
|
127
|
+
-webkit-appearance: none;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
#{$self}__label {
|
|
131
|
+
left: 12px;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&__input-mob-search {
|
|
136
|
+
border-top-right-radius: 0;
|
|
137
|
+
border-bottom-right-radius: 0;
|
|
138
|
+
-webkit-appearance: none;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&__error {
|
|
142
|
+
text-align: left;
|
|
143
|
+
font-size: var(--fs-content-micro);
|
|
144
|
+
line-height: 14px;
|
|
145
|
+
color: #ff2e43;
|
|
146
|
+
margin-top: 6px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&__field {
|
|
150
|
+
position: relative;
|
|
151
|
+
overflow: hidden;
|
|
152
|
+
@media(max-width: 1025px) {
|
|
153
|
+
width: 100%;
|
|
154
|
+
display: flex;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&__input {
|
|
159
|
+
background: #ffffff;
|
|
160
|
+
border: 1px solid #c4c4c4;
|
|
161
|
+
box-sizing: border-box;
|
|
162
|
+
border-radius: 2px;
|
|
163
|
+
width: 100%;
|
|
164
|
+
height: 40px;
|
|
165
|
+
font-size: var(--fs-form);
|
|
166
|
+
color: #1A2030;
|
|
167
|
+
padding: 19px 40px 5px 16px;
|
|
168
|
+
transition: 0.3s all;
|
|
169
|
+
@media(max-width: 1025px) {
|
|
170
|
+
padding: 19px 36px 7px 12px;
|
|
171
|
+
height: 40px;
|
|
172
|
+
border: 1px solid #71757A;
|
|
173
|
+
font-size: var(--fs-content-mini);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&:focus ~ #{$self}__label,
|
|
177
|
+
&:not(:focus):valid ~ #{$self}__label {
|
|
178
|
+
top: 12px;
|
|
179
|
+
font-size: var(--fs-content-micro);
|
|
180
|
+
color: #71757A;
|
|
181
|
+
@media(max-width: 1025px) {
|
|
182
|
+
font-size: var(--fs-content-nano);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&:focus {
|
|
187
|
+
border: 1px solid #2c3e50;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&::placeholder {
|
|
191
|
+
font-size: 12px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&.error {
|
|
195
|
+
background: #ff2e431f;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&__label {
|
|
200
|
+
position: absolute;
|
|
201
|
+
pointer-events: none;
|
|
202
|
+
left: 16px;
|
|
203
|
+
top: 50%;
|
|
204
|
+
transform: translateY(-50%);
|
|
205
|
+
white-space: nowrap;
|
|
206
|
+
overflow: hidden;
|
|
207
|
+
line-height: 40px;
|
|
208
|
+
transition: 0.3s;
|
|
209
|
+
color: #71757A;
|
|
210
|
+
font-size: var(--fs-form-placeholder);
|
|
211
|
+
@media(max-width: 1025px) {
|
|
212
|
+
left: 12px;
|
|
213
|
+
font-size: var(--fs-content-micro);
|
|
214
|
+
line-height: 16px;
|
|
215
|
+
color: #71757A;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
&__icon {
|
|
220
|
+
position: absolute;
|
|
221
|
+
right: 16px;
|
|
222
|
+
height: 100%;
|
|
223
|
+
top: 0;
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
|
|
227
|
+
&:hover {
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&__required {
|
|
233
|
+
color: #FF000087;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
&__options {
|
|
237
|
+
position: absolute;
|
|
238
|
+
top: calc(100% + 4px);
|
|
239
|
+
left: 0;
|
|
240
|
+
width: 100%;
|
|
241
|
+
background: #fff;
|
|
242
|
+
z-index: 1000;
|
|
243
|
+
border-radius: 2px;
|
|
244
|
+
border: 1px solid #71757A;
|
|
245
|
+
padding: 12px 0;
|
|
246
|
+
@media(max-width: 1025px) {
|
|
247
|
+
overflow: auto;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
#searchVariant {
|
|
251
|
+
background: #eef0f5;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.search-options {
|
|
256
|
+
&__item {
|
|
257
|
+
padding: 5px 16px;
|
|
258
|
+
line-height: 16px;
|
|
259
|
+
font-size: 14px;
|
|
260
|
+
color: var(--newGray);
|
|
261
|
+
transition: 0.3s all;
|
|
262
|
+
cursor: pointer;
|
|
263
|
+
@media(max-width: 1025px) {
|
|
264
|
+
font-size: 10px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
&:hover {
|
|
268
|
+
background: #eef0f5;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.mobile-magnifier {
|
|
274
|
+
display: flex;
|
|
275
|
+
justify-content: center;
|
|
276
|
+
align-items: center;
|
|
277
|
+
height: 40px;
|
|
278
|
+
width: 40px;
|
|
279
|
+
min-width: 40px;
|
|
280
|
+
border: 1px solid #71757A;
|
|
281
|
+
border-radius: 0 2px 2px 0;
|
|
282
|
+
border-left: none;
|
|
283
|
+
background: #FFCD33;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&__input-mob-filter {
|
|
287
|
+
background: #ffffff;
|
|
288
|
+
border: 1px solid #71757A;
|
|
289
|
+
border-bottom: none;
|
|
290
|
+
box-sizing: border-box;
|
|
291
|
+
border-radius: 2px;
|
|
292
|
+
width: 100%;
|
|
293
|
+
height: 48px;
|
|
294
|
+
font-size: 16px;
|
|
295
|
+
line-height: 19px;
|
|
296
|
+
display: flex;
|
|
297
|
+
align-items: center;
|
|
298
|
+
color: #1A2030;
|
|
299
|
+
padding: 19px 40px 5px 16px;
|
|
300
|
+
transition: 0.3s all;
|
|
301
|
+
-webkit-appearance: none;
|
|
302
|
+
-moz-appearance: none;
|
|
303
|
+
appearance: none;
|
|
304
|
+
|
|
305
|
+
&:focus ~ #{$self}__label-mob-filter,
|
|
306
|
+
&:not(:focus):valid ~ #{$self}__label-mob-filter {
|
|
307
|
+
top: 11px;
|
|
308
|
+
font-size: 10px;
|
|
309
|
+
color: #71757A;
|
|
310
|
+
@media(max-width: 1025px) {
|
|
311
|
+
font-size: 7px;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&:focus {
|
|
316
|
+
border: 1px solid #2c3e50;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
&::placeholder {
|
|
320
|
+
font-size: 12px;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
&.error {
|
|
324
|
+
background: #ff2e431f;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
&__label-mob-filter {
|
|
329
|
+
position: absolute;
|
|
330
|
+
pointer-events: none;
|
|
331
|
+
left: 16px;
|
|
332
|
+
top: 50%;
|
|
333
|
+
transform: translateY(-50%);
|
|
334
|
+
white-space: nowrap;
|
|
335
|
+
overflow: hidden;
|
|
336
|
+
line-height: 40px;
|
|
337
|
+
transition: 0.3s;
|
|
338
|
+
color: #71757A;
|
|
339
|
+
@media(max-width: 1025px) {
|
|
340
|
+
left: 16px;
|
|
341
|
+
font-size: 14px;
|
|
342
|
+
line-height: 16px;
|
|
343
|
+
color: #71757A;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
&__red {
|
|
347
|
+
color: rgba(255, 0, 0, 0.53);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
&__magnifier {
|
|
351
|
+
left: 8px;
|
|
352
|
+
width: fit-content;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
</style>
|
package/src/components/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import AButton from './Button/BaseButton'
|
|
3
|
+
import ATextField from './TextField/TextField'
|
|
4
|
+
import APasswordField from './PasswordField/PasswordField'
|
|
5
|
+
import AAlert from './Alert/Alert'
|
|
4
6
|
|
|
5
7
|
const Components = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
AButton,
|
|
9
|
+
ATextField,
|
|
10
|
+
APasswordField,
|
|
11
|
+
AAlert
|
|
8
12
|
};
|
|
9
13
|
|
|
10
14
|
Object.keys(Components).forEach(name => {
|
|
@@ -0,0 +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
|
+
};
|
|
@@ -0,0 +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>
|
|
@@ -0,0 +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 = {};
|
|
@@ -0,0 +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>
|