@magicgol/polyjuice 0.24.2 → 0.27.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.2",
3
+ "version": "0.27.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -0,0 +1,46 @@
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
+ background: true,
44
+ default: 'contenuto generico'
45
+ };
46
+
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <div
3
+ class="px-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
+ background: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ left: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ top: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ right: {
35
+ type: Boolean,
36
+ default: false,
37
+ },
38
+ bottom: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ },
43
+
44
+ computed: {
45
+ classes() {
46
+ return {
47
+ 'mg-footballer-box': true,
48
+ 'mg-footballer-box--background': this.background === true,
49
+ 'mg-footballer-box--goalkeeper': this.role === 'P',
50
+ 'mg-footballer-box--defender': this.role === 'D',
51
+ 'mg-footballer-box--midfielder': this.role === 'C',
52
+ 'mg-footballer-box--forward': this.role === 'A',
53
+ 'mg-footballer-box--left': this.left === true,
54
+ 'mg-footballer-box--top': this.top === true,
55
+ 'mg-footballer-box--right': this.right === true,
56
+ 'mg-footballer-box--bottom': this.bottom === true,
57
+ };
58
+ },
59
+ },
60
+ };
61
+ </script>
62
+
63
+ <style lang="scss">
64
+ @import '../../../assets/palette';
65
+
66
+ .mg-footballer-box {
67
+ border-style: solid;
68
+ border-width: 0;
69
+
70
+ &--goalkeeper {
71
+ border-color: map-get($palette, 'goalkeeper');
72
+
73
+ &.mg-footballer-box--background {
74
+ background-color: rgba(map-get($palette, 'goalkeeper'), 0.1);
75
+ }
76
+ }
77
+
78
+ &--defender {
79
+ border-color: map-get($palette, 'defender');
80
+
81
+ &.mg-footballer-box--background {
82
+ background-color: rgba(map-get($palette, 'defender'), 0.1);
83
+ }
84
+ }
85
+
86
+ &--midfielder {
87
+ border-color: map-get($palette, 'midfielder');
88
+
89
+ &.mg-footballer-box--background {
90
+ background-color: rgba(map-get($palette, 'midfielder'), 0.1);
91
+ }
92
+ }
93
+
94
+ &--forward {
95
+ border-color: map-get($palette, 'forward');
96
+
97
+ &.mg-footballer-box--background {
98
+ background-color: rgba(map-get($palette, 'forward'), 0.1);
99
+ }
100
+ }
101
+
102
+ &--left {
103
+ border-left-width: 2px;
104
+ }
105
+
106
+ &--top {
107
+ border-top-width: 2px;
108
+ }
109
+
110
+ &--right {
111
+ border-right-width: 2px;
112
+ }
113
+
114
+ &--bottom {
115
+ border-bottom-width: 2px;
116
+ }
117
+ }
118
+ </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 = {
@@ -6,7 +6,7 @@
6
6
  <!-- FOOTBALLER NAME -->
7
7
  <div
8
8
  class="d-flex flex-fill text-truncate"
9
- :class="{'text-right': inverted, 'order-1': !inverted, 'flex-row': !isLarge, 'flex-column': isLarge}"
9
+ :class="{'justify-content-end': inverted, 'order-1': !inverted, 'flex-row': !isLarge, 'flex-column': isLarge}"
10
10
  >
11
11
  <div class="text-truncate">
12
12
  <!-- LAST NAME ONLY -->
@@ -53,6 +53,10 @@ export default {
53
53
  type: Boolean,
54
54
  default: false,
55
55
  },
56
+ deactivated: {
57
+ type: Boolean,
58
+ default: false,
59
+ },
56
60
  role: {
57
61
  type: String,
58
62
  default: null,
@@ -82,6 +86,7 @@ export default {
82
86
  return {
83
87
  'mg-h-footballer': true,
84
88
  'mg-h-footballer--disabled': this.disabled,
89
+ 'mg-h-footballer--deactivated': this.deactivated,
85
90
  'mg-h-footballer--size-normal': this.size === 'normal',
86
91
  'mg-h-footballer--size-large': this.size === 'large',
87
92
  };
@@ -130,6 +135,11 @@ export default {
130
135
  &--disabled {
131
136
  opacity: 0.6;
132
137
  cursor: not-allowed !important;
138
+ }
139
+
140
+ &--deactivated {
141
+ opacity: 0.6;
142
+ cursor: not-allowed !important;
133
143
 
134
144
  .mg-h-footballer-subtext {
135
145
  text-decoration: line-through;