@magicgol/polyjuice 0.24.2 → 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.2",
3
+ "version": "0.25.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -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 = {
@@ -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;