@magicgol/polyjuice 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicgol/polyjuice",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -15,6 +15,7 @@ $palette: (
15
15
  'defender': #89f4a1,
16
16
  'midfielder': #8fc6f9,
17
17
  'forward': #f58383,
18
+ 'bench': #bbb,
18
19
  // LIVE
19
20
  'online': #00b669,
20
21
  'offline': #ea7203,
@@ -20,7 +20,17 @@ export default {
20
20
  },
21
21
  theme: {
22
22
  control: { type: 'select' },
23
- options: [null, 'club', 'rating', 'goalkeeper', 'defender', 'midfielder', 'forward', 'transparent'],
23
+ options: [
24
+ null,
25
+ 'club',
26
+ 'rating',
27
+ 'goalkeeper',
28
+ 'defender',
29
+ 'midfielder',
30
+ 'forward',
31
+ 'bench',
32
+ 'transparent',
33
+ ],
24
34
  defaultValue: null
25
35
  },
26
36
  footer: {
@@ -25,7 +25,16 @@ export default {
25
25
  type: String,
26
26
  default: null,
27
27
  validator: function (value) {
28
- return ['club', 'rating', 'goalkeeper', 'defender', 'midfielder', 'forward', 'transparent'].indexOf(value) !== -1;
28
+ return [
29
+ 'club',
30
+ 'rating',
31
+ 'goalkeeper',
32
+ 'defender',
33
+ 'midfielder',
34
+ 'forward',
35
+ 'bench',
36
+ 'transparent',
37
+ ].indexOf(value) !== -1;
29
38
  },
30
39
  }
31
40
  },
@@ -40,6 +49,7 @@ export default {
40
49
  'mg-v-card--theme-defender': this.theme === 'defender',
41
50
  'mg-v-card--theme-midfielder': this.theme === 'midfielder',
42
51
  'mg-v-card--theme-forward': this.theme === 'forward',
52
+ 'mg-v-card--theme-bench': this.theme === 'bench',
43
53
  'mg-v-card--theme-transparent': this.theme === 'transparent',
44
54
  };
45
55
  },
@@ -90,6 +100,10 @@ export default {
90
100
  background-color: map-get($palette, 'forward');
91
101
  }
92
102
 
103
+ &-bench {
104
+ background-color: map-get($palette, 'bench');
105
+ }
106
+
93
107
  &-transparent {
94
108
  background: rgba(255, 255, 255, 0.95) !important;
95
109
  box-shadow: none;
@@ -0,0 +1,45 @@
1
+ import MgFootballerBox from './FootballerBox.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Footballer/Box',
6
+ component: MgFootballerBox,
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
+ default: {
15
+ description: "The default Vue slot",
16
+ control: {
17
+ type: 'text',
18
+ },
19
+ table: {
20
+ category: 'Slots',
21
+ type: {
22
+ summary: 'html',
23
+ },
24
+ }
25
+ },
26
+ },
27
+ };
28
+
29
+ // More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
30
+ const Template = (args, { argTypes }) => ({
31
+ props: Object.keys(argTypes),
32
+ components: { MgFootballerBox },
33
+ template: `<mg-footballer-box @click="$emit('click')" v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-footballer-box>`,
34
+ });
35
+
36
+ export const Default = Template.bind({});
37
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
38
+ Default.args = {
39
+ left: true,
40
+ top: true,
41
+ right: true,
42
+ bottom: true,
43
+ default: 'contenuto generico'
44
+ };
45
+
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <div
3
+ class="pl-2 py-1"
4
+ :class="classes"
5
+ >
6
+ <slot></slot>
7
+ </div>
8
+ </template>
9
+
10
+ <script>
11
+ export default {
12
+ name: 'mg-footballer-box',
13
+
14
+ props: {
15
+ role: {
16
+ type: String,
17
+ default: null,
18
+ validator: function (value) {
19
+ return ['P', 'D', 'C', 'A'].indexOf(value) !== -1;
20
+ },
21
+ },
22
+ left: {
23
+ type: Boolean,
24
+ default: false,
25
+ },
26
+ top: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ right: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ bottom: {
35
+ type: Boolean,
36
+ default: false,
37
+ },
38
+ },
39
+
40
+ computed: {
41
+ classes() {
42
+ return {
43
+ 'mg-footballer-box': true,
44
+ 'mg-footballer-box--goalkeeper': this.role === 'P',
45
+ 'mg-footballer-box--defender': this.role === 'D',
46
+ 'mg-footballer-box--midfielder': this.role === 'C',
47
+ 'mg-footballer-box--forward': this.role === 'A',
48
+ 'mg-footballer-box--left': this.left === true,
49
+ 'mg-footballer-box--top': this.top === true,
50
+ 'mg-footballer-box--right': this.right === true,
51
+ 'mg-footballer-box--bottom': this.bottom === true,
52
+ };
53
+ },
54
+ },
55
+ };
56
+ </script>
57
+
58
+ <style lang="scss">
59
+ @import '../../../assets/palette';
60
+
61
+ .mg-footballer-box {
62
+ border-style: solid;
63
+ border-width: 0;
64
+
65
+ &--goalkeeper {
66
+ border-color: map-get($palette, 'goalkeeper');
67
+ }
68
+
69
+ &--defender {
70
+ border-color: map-get($palette, 'defender');
71
+ }
72
+
73
+ &--midfielder {
74
+ border-color: map-get($palette, 'midfielder');
75
+ }
76
+
77
+ &--forward {
78
+ border-color: map-get($palette, 'forward');
79
+ }
80
+
81
+ &--left {
82
+ border-left-width: 2px;
83
+ }
84
+
85
+ &--top {
86
+ border-top-width: 2px;
87
+ }
88
+
89
+ &--right {
90
+ border-right-width: 2px;
91
+ }
92
+
93
+ &--bottom {
94
+ border-bottom-width: 2px;
95
+ }
96
+ }
97
+ </style>
@@ -61,6 +61,15 @@ Disabled.args = {
61
61
  lastname: 'Dybala',
62
62
  };
63
63
 
64
+ export const Deactivated = Template.bind({});
65
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
66
+ Disabled.args = {
67
+ deactivated: true,
68
+ role: 'A',
69
+ firstname: 'Paulo',
70
+ lastname: 'Dybala',
71
+ };
72
+
64
73
  export const Large = Template.bind({});
65
74
  // More on args: https://storybook.js.org/docs/vue/writing-stories/args
66
75
  Large.args = {
@@ -5,8 +5,8 @@
5
5
  >
6
6
  <!-- FOOTBALLER NAME -->
7
7
  <div
8
- class="flex-fill text-truncate"
9
- v-bind:class="{'text-right': inverted, 'order-1': !inverted}"
8
+ class="d-flex flex-fill text-truncate"
9
+ :class="{'text-right': inverted, 'order-1': !inverted, 'flex-row': !isLarge, 'flex-column': isLarge}"
10
10
  >
11
11
  <div class="text-truncate">
12
12
  <!-- LAST NAME ONLY -->
@@ -17,11 +17,14 @@
17
17
  <!-- end of LAST NAME ONLY -->
18
18
  <!-- FULL NAME -->
19
19
  <span v-else-if="hasName">
20
- <span class="mg-h-footballer-strong">{{ lastname }}</span>, <span>{{ firstname }}</span>
21
- </span>
20
+ <span class="mg-h-footballer-strong">{{ lastname }}</span>, <span>{{ firstname }}</span>
21
+ </span>
22
22
  <span v-else>&ndash;</span>
23
23
  </div>
24
- <div class="mg-h-footballer-subtext"><slot></slot></div>
24
+ <div
25
+ v-if="slotVisibility"
26
+ class="mg-h-footballer-subtext text-uppercase"
27
+ ><span v-if="!isLarge" class="mx-2">-</span><slot></slot></div>
25
28
  </div>
26
29
  <!-- end of FOOTBALLER NAME -->
27
30
  <!-- ROLE BADGE -->
@@ -50,6 +53,10 @@ export default {
50
53
  type: Boolean,
51
54
  default: false,
52
55
  },
56
+ deactivated: {
57
+ type: Boolean,
58
+ default: false,
59
+ },
53
60
  role: {
54
61
  type: String,
55
62
  default: null,
@@ -79,15 +86,22 @@ export default {
79
86
  return {
80
87
  'mg-h-footballer': true,
81
88
  'mg-h-footballer--disabled': this.disabled,
89
+ 'mg-h-footballer--deactivated': this.deactivated,
82
90
  'mg-h-footballer--size-normal': this.size === 'normal',
83
91
  'mg-h-footballer--size-large': this.size === 'large',
84
92
  };
85
93
  },
94
+ isLarge () {
95
+ return this.size === 'large';
96
+ },
86
97
  hasOnlyLastname() {
87
98
  return this.lastname != null && this.firstname == null;
88
99
  },
89
100
  hasName () {
90
101
  return this.lastname != null || this.firstname != null;
102
+ },
103
+ slotVisibility() {
104
+ return 'default' in this.$slots && !!this.$slots.default;
91
105
  }
92
106
  },
93
107
 
@@ -123,9 +137,18 @@ export default {
123
137
  cursor: not-allowed !important;
124
138
  }
125
139
 
140
+ &--deactivated {
141
+ opacity: 0.6;
142
+ cursor: not-allowed !important;
143
+
144
+ .mg-h-footballer-subtext {
145
+ text-decoration: line-through;
146
+ }
147
+ }
148
+
126
149
  &--size {
127
150
  &-normal {
128
- font-size: 0.75rem;
151
+ font-size: 0.875rem;
129
152
  }
130
153
 
131
154
  &-large {
@@ -2,7 +2,6 @@
2
2
  <div
3
3
  class="d-inline-flex rounded-circle align-items-center justify-content-center text-white"
4
4
  :class="classes"
5
- @click="onClick"
6
5
  ><slot></slot></div>
7
6
  </template>
8
7
 
@@ -10,9 +9,6 @@
10
9
  export default {
11
10
  name: 'mg-label-badge',
12
11
 
13
- props: {
14
- },
15
-
16
12
  computed: {
17
13
  classes() {
18
14
  return {
@@ -19,4 +19,8 @@ import {ColorItem, ColorPalette, Meta} from '@storybook/addon-docs';
19
19
  title="Forward"
20
20
  colors={{'Froly': '#f58383'}}
21
21
  />
22
+ <ColorItem
23
+ title="Bench"
24
+ colors={{'Silver': '#bbb'}}
25
+ />
22
26
  </ColorPalette>