@magicgol/polyjuice 0.21.2 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/components/footballer/horizontal-footballer/HFootballer.stories.js +36 -0
- package/src/components/footballer/horizontal-footballer/HFootballer.vue +98 -0
- package/src/components/footballer/horizontal-placeholder/{HPlaceholder.stories.js → HFootballerPlaceholder.stories.js} +12 -7
- package/src/components/footballer/horizontal-placeholder/{HPlaceholder.vue → HFootballerPlaceholder.vue} +35 -6
package/package.json
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
import MgHFootballer from './HFootballer.vue';
|
2
|
+
|
3
|
+
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
|
4
|
+
export default {
|
5
|
+
title: 'Footballer/HFootballer',
|
6
|
+
component: MgHFootballer,
|
7
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
8
|
+
argTypes: {
|
9
|
+
role: {
|
10
|
+
control: { type: 'select' },
|
11
|
+
options: [null, 'P', 'D', 'C', 'A'],
|
12
|
+
defaultValue: 'A'
|
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: { MgHFootballer },
|
21
|
+
template: `<mg-h-footballer @click="$emit('click')" v-bind="$props"></mg-h-footballer>`,
|
22
|
+
});
|
23
|
+
|
24
|
+
export const Default = Template.bind({});
|
25
|
+
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
26
|
+
Default.args = {
|
27
|
+
role: 'A',
|
28
|
+
firstname: 'Paulo',
|
29
|
+
lastname: 'Dybala',
|
30
|
+
};
|
31
|
+
|
32
|
+
export const Empty = Template.bind({});
|
33
|
+
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
34
|
+
Empty.args = {
|
35
|
+
role: null
|
36
|
+
};
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
class="align-items-center d-flex text-truncate"
|
4
|
+
:class="classes"
|
5
|
+
>
|
6
|
+
<!-- FOOTBALLER NAME -->
|
7
|
+
<div
|
8
|
+
class="flex-fill text-truncate"
|
9
|
+
v-bind:class="{'text-right': inverted, 'order-1': !inverted}"
|
10
|
+
>
|
11
|
+
<!-- LAST NAME ONLY -->
|
12
|
+
<span
|
13
|
+
v-if="hasOnlyLastname"
|
14
|
+
class="mg-h-footballer-strong"
|
15
|
+
>{{ lastname }}</span>
|
16
|
+
<!-- end of LAST NAME ONLY -->
|
17
|
+
<!-- FULL NAME -->
|
18
|
+
<span v-else-if="hasName">
|
19
|
+
<span class="mg-h-footballer-strong">{{ lastname }}</span>, <span>{{ firstname }}</span>
|
20
|
+
</span>
|
21
|
+
<span v-else>–</span>
|
22
|
+
</div>
|
23
|
+
<!-- end of FOOTBALLER NAME -->
|
24
|
+
<!-- ROLE BADGE -->
|
25
|
+
<div v-bind:class="{'pl-2': inverted, 'pr-2': !inverted}">
|
26
|
+
<mg-role-badge :role="role"></mg-role-badge>
|
27
|
+
</div>
|
28
|
+
<!-- end of ROLE BADGE -->
|
29
|
+
</div>
|
30
|
+
</template>
|
31
|
+
|
32
|
+
<script>
|
33
|
+
import MgRoleBadge from "../role-badge/RoleBadge";
|
34
|
+
|
35
|
+
export default {
|
36
|
+
name: 'mg-h-footballer',
|
37
|
+
|
38
|
+
props: {
|
39
|
+
inverted: {
|
40
|
+
type: Boolean,
|
41
|
+
default: false,
|
42
|
+
},
|
43
|
+
role: {
|
44
|
+
type: String,
|
45
|
+
default: null,
|
46
|
+
validator: function (value) {
|
47
|
+
return ['P', 'D', 'C', 'A'].indexOf(value) !== -1;
|
48
|
+
},
|
49
|
+
},
|
50
|
+
firstname: {
|
51
|
+
type: String,
|
52
|
+
default: null
|
53
|
+
},
|
54
|
+
lastname: {
|
55
|
+
type: String,
|
56
|
+
default: null
|
57
|
+
},
|
58
|
+
},
|
59
|
+
|
60
|
+
computed: {
|
61
|
+
classes() {
|
62
|
+
return {
|
63
|
+
'mg-h-footballer': true,
|
64
|
+
};
|
65
|
+
},
|
66
|
+
hasOnlyLastname() {
|
67
|
+
return this.lastname != null && this.firstname == null;
|
68
|
+
},
|
69
|
+
hasName () {
|
70
|
+
return this.lastname != null || this.firstname != null;
|
71
|
+
}
|
72
|
+
},
|
73
|
+
|
74
|
+
components: {
|
75
|
+
MgRoleBadge
|
76
|
+
},
|
77
|
+
|
78
|
+
methods: {
|
79
|
+
onClick() {
|
80
|
+
this.$emit('click');
|
81
|
+
},
|
82
|
+
},
|
83
|
+
};
|
84
|
+
</script>
|
85
|
+
|
86
|
+
<style lang="scss">
|
87
|
+
@import '../../../assets/palette';
|
88
|
+
|
89
|
+
.mg-h-footballer {
|
90
|
+
color: #343434;
|
91
|
+
font-family: 'Ubuntu', sans-serif;
|
92
|
+
font-size: 0.75rem;
|
93
|
+
|
94
|
+
&-strong {
|
95
|
+
font-weight: 500;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
</style>
|
@@ -1,15 +1,20 @@
|
|
1
|
-
import
|
1
|
+
import MgHFootballerPlaceholder from './HFootballerPlaceholder.vue';
|
2
2
|
|
3
3
|
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
|
4
4
|
export default {
|
5
5
|
title: 'Footballer/HPlaceholder',
|
6
|
-
component:
|
6
|
+
component: MgHFootballerPlaceholder,
|
7
7
|
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
8
8
|
argTypes: {
|
9
9
|
ownership: {
|
10
10
|
control: { type: 'select' },
|
11
|
-
options: ['owned', 'opponent'],
|
12
|
-
defaultValue:
|
11
|
+
options: [null, 'owned', 'opponent'],
|
12
|
+
defaultValue: null
|
13
|
+
},
|
14
|
+
role: {
|
15
|
+
control: { type: 'select' },
|
16
|
+
options: [null, 'P', 'D', 'C', 'A'],
|
17
|
+
defaultValue: null
|
13
18
|
},
|
14
19
|
default: {
|
15
20
|
description: "The default Vue slot",
|
@@ -29,10 +34,10 @@ export default {
|
|
29
34
|
// More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
|
30
35
|
const Template = (args, { argTypes }) => ({
|
31
36
|
props: Object.keys(argTypes),
|
32
|
-
components: {
|
33
|
-
template: `<mg-h-placeholder @click="$emit('click')" v-bind="$props">
|
37
|
+
components: { MgHFootballerPlaceholder },
|
38
|
+
template: `<mg-h-footballer-placeholder @click="$emit('click')" v-bind="$props">
|
34
39
|
<template v-if="${'default' in args}" v-slot>${args.default}</template>
|
35
|
-
</mg-h-placeholder>`,
|
40
|
+
</mg-h-footballer-placeholder>`,
|
36
41
|
});
|
37
42
|
|
38
43
|
export const Default = Template.bind({});
|
@@ -14,12 +14,19 @@
|
|
14
14
|
|
15
15
|
<script>
|
16
16
|
export default {
|
17
|
-
name: 'mg-h-placeholder',
|
17
|
+
name: 'mg-footballer-h-placeholder',
|
18
18
|
|
19
19
|
props: {
|
20
|
+
role: {
|
21
|
+
type: String,
|
22
|
+
default: null,
|
23
|
+
validator: function (value) {
|
24
|
+
return ['P', 'D', 'C', 'A'].indexOf(value) !== -1;
|
25
|
+
},
|
26
|
+
},
|
20
27
|
ownership: {
|
21
28
|
type: String,
|
22
|
-
default:
|
29
|
+
default: null,
|
23
30
|
validator: function (value) {
|
24
31
|
return ['owned', 'opponent'].indexOf(value) !== -1;
|
25
32
|
},
|
@@ -29,9 +36,13 @@ export default {
|
|
29
36
|
computed: {
|
30
37
|
classes() {
|
31
38
|
return {
|
32
|
-
'mg-h-placeholder': true,
|
33
|
-
'mg-h-placeholder--ownership-owned': this.ownership === 'owned',
|
34
|
-
'mg-h-placeholder--ownership-opponent': this.ownership === 'opponent',
|
39
|
+
'mg-footballer-h-placeholder': true,
|
40
|
+
'mg-footballer-h-placeholder--ownership-owned': this.ownership === 'owned',
|
41
|
+
'mg-footballer-h-placeholder--ownership-opponent': this.ownership === 'opponent',
|
42
|
+
'mg-footballer-h-placeholder--role-goalkeeper': this.role === 'P',
|
43
|
+
'mg-footballer-h-placeholder--role-defender': this.role === 'D',
|
44
|
+
'mg-footballer-h-placeholder--role-midfielder': this.role === 'C',
|
45
|
+
'mg-footballer-h-placeholder--role-forward': this.role === 'A',
|
35
46
|
};
|
36
47
|
},
|
37
48
|
},
|
@@ -47,7 +58,7 @@ export default {
|
|
47
58
|
<style lang="scss">
|
48
59
|
@import '../../../assets/palette';
|
49
60
|
|
50
|
-
.mg-h-placeholder {
|
61
|
+
.mg-footballer-h-placeholder {
|
51
62
|
background: white;
|
52
63
|
border: 2px dashed;
|
53
64
|
color: #777777;
|
@@ -70,5 +81,23 @@ export default {
|
|
70
81
|
border-color: rgba(map-get($palette, 'opponent'), 0.5);
|
71
82
|
}
|
72
83
|
}
|
84
|
+
|
85
|
+
&--role {
|
86
|
+
&-goalkeeper {
|
87
|
+
border-color: rgba(map-get($palette, 'goalkeeper'), 0.5);
|
88
|
+
}
|
89
|
+
|
90
|
+
&-defender {
|
91
|
+
border-color: rgba(map-get($palette, 'defender'), 0.5);
|
92
|
+
}
|
93
|
+
|
94
|
+
&-midfielder {
|
95
|
+
border-color: rgba(map-get($palette, 'midfielder'), 0.5);
|
96
|
+
}
|
97
|
+
|
98
|
+
&-forward {
|
99
|
+
border-color: rgba(map-get($palette, 'forward'), 0.5);
|
100
|
+
}
|
101
|
+
}
|
73
102
|
}
|
74
103
|
</style>
|