@magicgol/polyjuice 0.21.2 → 0.22.2

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.21.2",
3
+ "version": "0.22.2",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="d-flex justify-content-between align-items-center rounded px-3"
3
+ class="d-flex justify-content-between align-items-center rounded px-3 bg-white"
4
4
  v-bind:class="classes"
5
5
  >
6
6
  <div
@@ -20,7 +20,7 @@ export default {
20
20
  },
21
21
  theme: {
22
22
  control: { type: 'select' },
23
- options: [null, 'club'],
23
+ options: [null, 'club', 'rating', 'goalkeeper', 'defender', 'midfielder', 'forward'],
24
24
  defaultValue: null
25
25
  },
26
26
  footer: {
@@ -60,3 +60,51 @@ Footer.args = {
60
60
  default: '<div>This is a vertical card.</div><div>What do you think about?</div>',
61
61
  footer: '<div>The footer content goes here</div>'
62
62
  };
63
+
64
+ export const Club = Template.bind({});
65
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
66
+ Club.args = {
67
+ theme: 'club',
68
+ default: '<div>This is a vertical card.</div><div>What do you think about?</div>',
69
+ footer: '<div>The footer content goes here</div>'
70
+ };
71
+
72
+ export const Rating = Template.bind({});
73
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
74
+ Rating.args = {
75
+ theme: 'rating',
76
+ default: '<div>This is a vertical card.</div><div>What do you think about?</div>',
77
+ footer: '<div>The footer content goes here</div>'
78
+ };
79
+
80
+ export const Goalkeeper = Template.bind({});
81
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
82
+ Goalkeeper.args = {
83
+ theme: 'goalkeeper',
84
+ default: '<div>This is a vertical card.</div><div>What do you think about?</div>',
85
+ footer: '<div>The footer content goes here</div>'
86
+ };
87
+
88
+ export const Defender = Template.bind({});
89
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
90
+ Defender.args = {
91
+ theme: 'defender',
92
+ default: '<div>This is a vertical card.</div><div>What do you think about?</div>',
93
+ footer: '<div>The footer content goes here</div>'
94
+ };
95
+
96
+ export const Midfielder = Template.bind({});
97
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
98
+ Midfielder.args = {
99
+ theme: 'midfielder',
100
+ default: '<div>This is a vertical card.</div><div>What do you think about?</div>',
101
+ footer: '<div>The footer content goes here</div>'
102
+ };
103
+
104
+ export const Forward = Template.bind({});
105
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
106
+ Forward.args = {
107
+ theme: 'forward',
108
+ default: '<div>This is a vertical card.</div><div>What do you think about?</div>',
109
+ footer: '<div>The footer content goes here</div>'
110
+ };
@@ -25,7 +25,7 @@ export default {
25
25
  type: String,
26
26
  default: null,
27
27
  validator: function (value) {
28
- return ['club'].indexOf(value) !== -1;
28
+ return ['club', 'rating', 'goalkeeper', 'defender', 'midfielder', 'forward'].indexOf(value) !== -1;
29
29
  },
30
30
  }
31
31
  },
@@ -35,6 +35,11 @@ export default {
35
35
  return {
36
36
  'mg-v-card': true,
37
37
  'mg-v-card--theme-club': this.theme === 'club',
38
+ 'mg-v-card--theme-rating': this.theme === 'rating',
39
+ 'mg-v-card--theme-goalkeeper': this.theme === 'goalkeeper',
40
+ 'mg-v-card--theme-defender': this.theme === 'defender',
41
+ 'mg-v-card--theme-midfielder': this.theme === 'midfielder',
42
+ 'mg-v-card--theme-forward': this.theme === 'forward',
38
43
  };
39
44
  },
40
45
  footerVisibility() {
@@ -62,6 +67,27 @@ export default {
62
67
  background: linear-gradient(90deg, #D1EFFF 0%, #DDDAFC 99.65%) !important;
63
68
  color: #777;
64
69
  }
70
+
71
+ &-rating {
72
+ background-color: #f8fff8 !important;
73
+ color: #777;
74
+ }
75
+
76
+ &-goalkeeper {
77
+ background-color: map-get($palette, 'goalkeeper');
78
+ }
79
+
80
+ &-defender {
81
+ background-color: map-get($palette, 'defender');
82
+ }
83
+
84
+ &-midfielder {
85
+ background-color: map-get($palette, 'midfielder');
86
+ }
87
+
88
+ &-forward {
89
+ background-color: map-get($palette, 'forward');
90
+ }
65
91
  }
66
92
 
67
93
  &-footer {
@@ -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>&ndash;</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 MgHPlaceholder from './HPlaceholder.vue';
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: MgHPlaceholder,
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: 'owned'
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: { MgHPlaceholder },
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: 'owned',
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>