@magicgol/polyjuice 0.23.1 → 0.24.2

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.23.1",
3
+ "version": "0.24.2",
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;
@@ -11,6 +11,23 @@ export default {
11
11
  options: [null, 'P', 'D', 'C', 'A'],
12
12
  defaultValue: 'A'
13
13
  },
14
+ size: {
15
+ control: { type: 'select' },
16
+ options: ['normal', 'large'],
17
+ defaultValue: 'normal'
18
+ },
19
+ default: {
20
+ description: "The default Vue slot",
21
+ control: {
22
+ type: 'text',
23
+ },
24
+ table: {
25
+ category: 'Slots',
26
+ type: {
27
+ summary: 'html',
28
+ },
29
+ }
30
+ },
14
31
  },
15
32
  };
16
33
 
@@ -18,7 +35,7 @@ export default {
18
35
  const Template = (args, { argTypes }) => ({
19
36
  props: Object.keys(argTypes),
20
37
  components: { MgHFootballer },
21
- template: `<mg-h-footballer @click="$emit('click')" v-bind="$props"></mg-h-footballer>`,
38
+ template: `<mg-h-footballer @click="$emit('click')" v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-h-footballer>`,
22
39
  });
23
40
 
24
41
  export const Default = Template.bind({});
@@ -43,3 +60,13 @@ Disabled.args = {
43
60
  firstname: 'Paulo',
44
61
  lastname: 'Dybala',
45
62
  };
63
+
64
+ export const Large = Template.bind({});
65
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
66
+ Large.args = {
67
+ size: 'large',
68
+ role: 'A',
69
+ firstname: 'Paulo',
70
+ lastname: 'Dybala',
71
+ };
72
+
@@ -5,25 +5,34 @@
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
- <!-- 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>
11
+ <div class="text-truncate">
12
+ <!-- LAST NAME ONLY -->
13
+ <span
14
+ v-if="hasOnlyLastname"
15
+ class="mg-h-footballer-strong"
16
+ >{{ lastname }}</span>
17
+ <!-- end of LAST NAME ONLY -->
18
+ <!-- FULL NAME -->
19
+ <span v-else-if="hasName">
20
+ <span class="mg-h-footballer-strong">{{ lastname }}</span>, <span>{{ firstname }}</span>
21
+ </span>
22
+ <span v-else>&ndash;</span>
23
+ </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>
22
28
  </div>
23
29
  <!-- end of FOOTBALLER NAME -->
24
30
  <!-- ROLE BADGE -->
25
31
  <div v-bind:class="{'pl-2': inverted, 'pr-2': !inverted}">
26
- <mg-role-badge :role="role"></mg-role-badge>
32
+ <mg-role-badge
33
+ :role="role"
34
+ :size="size"
35
+ ></mg-role-badge>
27
36
  </div>
28
37
  <!-- end of ROLE BADGE -->
29
38
  </div>
@@ -59,6 +68,13 @@ export default {
59
68
  type: String,
60
69
  default: null
61
70
  },
71
+ size: {
72
+ type: String,
73
+ default: 'normal',
74
+ validator: function (value) {
75
+ return ['normal', 'large'].indexOf(value) !== -1;
76
+ },
77
+ },
62
78
  },
63
79
 
64
80
  computed: {
@@ -66,13 +82,21 @@ export default {
66
82
  return {
67
83
  'mg-h-footballer': true,
68
84
  'mg-h-footballer--disabled': this.disabled,
85
+ 'mg-h-footballer--size-normal': this.size === 'normal',
86
+ 'mg-h-footballer--size-large': this.size === 'large',
69
87
  };
70
88
  },
89
+ isLarge () {
90
+ return this.size === 'large';
91
+ },
71
92
  hasOnlyLastname() {
72
93
  return this.lastname != null && this.firstname == null;
73
94
  },
74
95
  hasName () {
75
96
  return this.lastname != null || this.firstname != null;
97
+ },
98
+ slotVisibility() {
99
+ return 'default' in this.$slots && !!this.$slots.default;
76
100
  }
77
101
  },
78
102
 
@@ -89,20 +113,37 @@ export default {
89
113
  </script>
90
114
 
91
115
  <style lang="scss">
92
- @import '../../../assets/palette';
116
+ @import '../../../assets/palette';
93
117
 
94
- .mg-h-footballer {
95
- color: map-get($palette, 'text');
96
- font-family: 'Ubuntu', sans-serif;
97
- font-size: 0.75rem;
118
+ .mg-h-footballer {
119
+ color: map-get($palette, 'text');
120
+ font-family: 'Ubuntu', sans-serif;
98
121
 
99
- &-strong {
100
- font-weight: 500;
101
- }
122
+ &-strong {
123
+ font-weight: 500;
124
+ }
102
125
 
103
- &--disabled {
104
- opacity: 0.6;
105
- cursor: not-allowed !important;
126
+ &-subtext {
127
+ font-size: 0.875rem;
128
+ }
129
+
130
+ &--disabled {
131
+ opacity: 0.6;
132
+ cursor: not-allowed !important;
133
+
134
+ .mg-h-footballer-subtext {
135
+ text-decoration: line-through;
136
+ }
137
+ }
138
+
139
+ &--size {
140
+ &-normal {
141
+ font-size: 0.875rem;
142
+ }
143
+
144
+ &-large {
145
+ font-size: 1rem;
146
+ }
147
+ }
106
148
  }
107
- }
108
149
  </style>
@@ -59,7 +59,7 @@ export default {
59
59
  background-color: #c2c2c2;
60
60
  color: map-get($palette, 'text');
61
61
  font-family: 'Ubuntu', sans-serif;
62
- font-weight: 600;
62
+ font-weight: 500;
63
63
 
64
64
  &--normal {
65
65
  font-size: 0.75rem;
@@ -70,9 +70,9 @@ export default {
70
70
 
71
71
  &--large {
72
72
  font-size: 1rem;
73
- height: 1.5rem;
74
- width: 1.5rem;
75
- min-width: 1.5rem;
73
+ height: 1.875rem;
74
+ width: 1.875rem;
75
+ min-width: 1.875rem;
76
76
  }
77
77
 
78
78
  &--huge {
@@ -0,0 +1,24 @@
1
+ import MgLabelBadge from './LabelBadge.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Label/Badge',
6
+ component: MgLabelBadge,
7
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
+ argTypes: {},
9
+ };
10
+
11
+ // More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
12
+ const Template = (args, { argTypes }) => ({
13
+ props: Object.keys(argTypes),
14
+ components: { MgLabelBadge },
15
+ template: `<mg-label-badge v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-label-badge>`,
16
+ });
17
+
18
+ export const Default = Template.bind({});
19
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
20
+ Default.args = {
21
+ default: '99'
22
+ };
23
+
24
+
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div
3
+ class="d-inline-flex rounded-circle align-items-center justify-content-center text-white"
4
+ :class="classes"
5
+ ><slot></slot></div>
6
+ </template>
7
+
8
+ <script>
9
+ export default {
10
+ name: 'mg-label-badge',
11
+
12
+ computed: {
13
+ classes() {
14
+ return {
15
+ 'mg-label-badge': true,
16
+ };
17
+ },
18
+ },
19
+ };
20
+ </script>
21
+
22
+ <style lang="scss">
23
+ @import '../../../assets/palette';
24
+
25
+ .mg-label-badge {
26
+ background-color: #84485E;
27
+ font-family: 'Ubuntu', sans-serif;
28
+ font-weight: 500;
29
+ height: 2rem;
30
+ width: 2rem;
31
+ }
32
+ </style>
@@ -13,7 +13,7 @@ import {ColorItem, ColorPalette, Meta} from '@storybook/addon-docs';
13
13
  />
14
14
  <ColorItem
15
15
  title="Coin"
16
- colors={{'Goldenrod': '#ffcf73'}}
16
+ colors={{'Golden Rod': '#ffcf73'}}
17
17
  />
18
18
  <ColorItem
19
19
  title="Expert Club Color"
@@ -5,7 +5,7 @@ import {ColorItem, ColorPalette, Meta} from '@storybook/addon-docs';
5
5
  <ColorPalette>
6
6
  <ColorItem
7
7
  title="Goalkeeper"
8
- colors={{'Goldenrod': '#fcd777'}}
8
+ colors={{'Golden Rod': '#fcd777'}}
9
9
  />
10
10
  <ColorItem
11
11
  title="Defender"
@@ -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>