@magicgol/polyjuice 0.12.0 → 0.13.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicgol/polyjuice",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -23,7 +23,7 @@ export default {
23
23
  };
24
24
  },
25
25
  footerVisibility() {
26
- return this.$slots['footer']
26
+ return 'footer' in this.$slots;
27
27
  }
28
28
  },
29
29
 
@@ -2,6 +2,7 @@
2
2
  <div
3
3
  class="d-inline-flex flex-column text-center"
4
4
  :class="classes"
5
+ @click="$emit('click')"
5
6
  >
6
7
  <svgicon
7
8
  name="star-c"
@@ -48,7 +49,7 @@ export default {
48
49
 
49
50
  svg {
50
51
  fill: map-get($palette, 'expertClub');
51
- height: 1.25rem;
52
+ height: 1.5rem;
52
53
  }
53
54
  }
54
55
  </style>
@@ -0,0 +1,56 @@
1
+ import MgRoleBadge from './RoleBadge.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Footballer/Role Badge',
6
+ component: MgRoleBadge,
7
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
+ argTypes: {
9
+ role: {
10
+ control: { type: 'select' },
11
+ options: ['P', 'D', 'C', 'A'],
12
+ defaultValue: 'A'
13
+ },
14
+ size: {
15
+ control: { type: 'select' },
16
+ options: ['large', 'normal'],
17
+ defaultValue: 'normal'
18
+ },
19
+ },
20
+ };
21
+
22
+ // More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
23
+ const Template = (args, { argTypes }) => ({
24
+ props: Object.keys(argTypes),
25
+ components: { MgRoleBadge },
26
+ template: `<mg-role-badge v-bind="$props"></mg-role-badge>`,
27
+ });
28
+
29
+ export const Default = Template.bind({});
30
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
31
+ Default.args = {
32
+ };
33
+
34
+ export const Goalkeeper = Template.bind({});
35
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
36
+ Goalkeeper.args = {
37
+ role: 'P',
38
+ };
39
+
40
+ export const Defender = Template.bind({});
41
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
42
+ Defender.args = {
43
+ role: 'D',
44
+ };
45
+
46
+ export const Midfielder = Template.bind({});
47
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
48
+ Midfielder.args = {
49
+ role: 'C',
50
+ };
51
+
52
+ export const Forward = Template.bind({});
53
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
54
+ Forward.args = {
55
+ role: 'A',
56
+ };
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div
3
+ class="d-inline-flex text-center text-white rounded-circle justify-content-center align-items-center"
4
+ :class="classes"
5
+ >
6
+ {{ role }}
7
+ </div>
8
+ </template>
9
+
10
+ <script>
11
+ export default {
12
+ name: 'mg-role-badge',
13
+
14
+ props: {
15
+ role: {
16
+ type: String,
17
+ default: 'A',
18
+ validator: function (value) {
19
+ return ['P', 'D', 'C', 'A'].indexOf(value) !== -1;
20
+ },
21
+ },
22
+ size: {
23
+ type: String,
24
+ default: 'normal',
25
+ validator: function (value) {
26
+ return ['normal', 'large'].indexOf(value) !== -1;
27
+ },
28
+ }
29
+ },
30
+
31
+ computed: {
32
+ classes() {
33
+ return {
34
+ 'mg-role-badge': true,
35
+ 'mg-role-badge--goalkeeper': this.role === 'P',
36
+ 'mg-role-badge--defender': this.role === 'D',
37
+ 'mg-role-badge--midfielder': this.role === 'C',
38
+ 'mg-role-badge--forward': this.role === 'A',
39
+ 'mg-role-badge--normal': this.size === 'normal',
40
+ 'mg-role-badge--large': this.size === 'large',
41
+ };
42
+ }
43
+ },
44
+ };
45
+ </script>
46
+
47
+ <style lang="scss">
48
+ @import '../../../assets/palette';
49
+
50
+ .mg-role-badge {
51
+ font-family: 'Ubuntu', sans-serif;
52
+ font-weight: 600;
53
+
54
+ &--normal {
55
+ font-size: 0.75rem;
56
+ height: 1.125rem;
57
+ width: 1.125rem;
58
+ min-width: 1.125rem;
59
+ }
60
+
61
+ &--large {
62
+ font-size: 0.875rem;
63
+ height: 1.5rem;
64
+ width: 1.5rem;
65
+ min-width: 1.5rem;
66
+ }
67
+
68
+ &--goalkeeper {
69
+ background-color: map-get($palette, 'goalkeeper');
70
+ }
71
+
72
+ &--defender {
73
+ background-color: map-get($palette, 'defender');
74
+ }
75
+
76
+ &--midfielder {
77
+ background-color: map-get($palette, 'midfielder');
78
+ }
79
+
80
+ &--forward {
81
+ background-color: map-get($palette, 'forward');
82
+ }
83
+ }
84
+ </style>
@@ -40,11 +40,11 @@ export default {
40
40
  classes() {
41
41
  return {
42
42
  'mg-toggle-button': true,
43
- 'mg-toggle-button--on': this.value === true
43
+ 'mg-toggle-button--on': this.value === true,
44
44
  };
45
45
  },
46
46
  contentVisibility() {
47
- return this.$slots['content'] && this.value === true
47
+ return 'content' in this.$slots && this.value === true;
48
48
  }
49
49
  },
50
50
  };
@@ -8,9 +8,14 @@ export default {
8
8
  argTypes: {
9
9
  size: {
10
10
  control: { type: 'select' },
11
- options: ['large', 'normal'],
11
+ options: ['large', 'normal', 'small', 'x-small'],
12
12
  defaultValue: 'normal'
13
13
  },
14
+ liveBadge: {
15
+ control: { type: 'select' },
16
+ options: [true, false],
17
+ defaultValue: false
18
+ },
14
19
  online: {
15
20
  control: { type: 'select' },
16
21
  options: [true, false],
@@ -20,13 +20,14 @@
20
20
  v-bind:style="{ backgroundImage: 'url(' + imageUrl + ')' }"
21
21
  ></div>
22
22
  <!-- end of PROFILE IMAGE LAYER -->
23
- <!-- ONLINE BADGE -->
23
+ <!-- LIVE BADGE -->
24
24
  <div
25
+ v-if="liveBadge"
25
26
  class="mg-live-badge position-absolute w-100"
26
27
  >
27
28
  <div class="w-100"></div>
28
29
  </div>
29
- <!-- end of ONLINE BADGE -->
30
+ <!-- end of LIVE BADGE -->
30
31
  </div>
31
32
  </template>
32
33
 
@@ -45,9 +46,13 @@ export default {
45
46
  type: String,
46
47
  default: 'normal',
47
48
  validator: function (value) {
48
- return ['large', 'normal'].indexOf(value) !== -1;
49
+ return ['large', 'normal', 'small', 'x-small'].indexOf(value) !== -1;
49
50
  },
50
51
  },
52
+ liveBadge: {
53
+ type: Boolean,
54
+ default: true
55
+ },
51
56
  online: {
52
57
  type: Boolean,
53
58
  default: false
@@ -58,15 +63,14 @@ export default {
58
63
  classes() {
59
64
  return {
60
65
  'mg-profile-image': true,
66
+ 'mg-profile-image--x-small': this.size === 'x-small',
67
+ 'mg-profile-image--small': this.size === 'small',
61
68
  'mg-profile-image--normal': this.size === 'normal',
62
69
  'mg-profile-image--large': this.size === 'large',
63
70
  'mg-profile-image--online': this.online === true,
64
71
  'mg-profile-image--offline': this.online === false,
65
72
  };
66
73
  },
67
- acronym() {
68
- return '';
69
- }
70
74
  },
71
75
  };
72
76
  </script>
@@ -79,14 +83,30 @@ export default {
79
83
  font-family: 'Ubuntu', sans-serif;
80
84
  font-weight: 600;
81
85
 
86
+ &--x-small {
87
+ height: 2rem;
88
+ min-width: 2rem;
89
+ font-size: 0.6875rem;
90
+ width: 2rem;
91
+ }
92
+
93
+ &--small {
94
+ height: 2.5rem;
95
+ min-width: 2.5rem;
96
+ font-size: 0.8125rem;
97
+ width: 2.5rem;
98
+ }
99
+
82
100
  &--normal {
83
101
  height: 3rem;
102
+ min-width: 3rem;
84
103
  font-size: 1.125rem;
85
104
  width: 3rem;
86
105
  }
87
106
 
88
107
  &--large {
89
108
  height: 5rem;
109
+ min-width: 5rem;
90
110
  font-size: 2rem;
91
111
  width: 5rem;
92
112
  }