@magicgol/polyjuice 0.39.3 → 0.40.1

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.39.3",
3
+ "version": "0.40.1",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -2,7 +2,7 @@ import MgBadge from './Badge.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
- title: 'Components/Badge',
5
+ title: 'Badge/Badge',
6
6
  component: MgBadge,
7
7
  // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
8
  argTypes: {},
@@ -0,0 +1,30 @@
1
+ import MgCounterBadge from './CounterBadge.vue';
2
+
3
+ // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
+ export default {
5
+ title: 'Badge/Counter',
6
+ component: MgCounterBadge,
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: { MgCounterBadge },
15
+ template: `<mg-counter-badge v-bind="$props"><template v-if="${'default' in args}" v-slot>${args.default}</template></mg-counter-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
+ count: 1
22
+ };
23
+
24
+ export const Many = Template.bind({});
25
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
26
+ Many.args = {
27
+ count: 10
28
+ };
29
+
30
+
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <div
3
+ class="d-inline-flex align-items-center rounded-circle justify-content-center"
4
+ :class="classes"
5
+ v-if="visible"
6
+ >
7
+ <span>{{ count >= 9 ? '9+' : count }}</span>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: 'mg-counter-badge',
14
+
15
+ props: {
16
+ count: {
17
+ type: Number,
18
+ default: 0
19
+ }
20
+ },
21
+
22
+ computed: {
23
+ classes() {
24
+ return {
25
+ 'mg-counter-badge': true,
26
+ };
27
+ },
28
+
29
+ visible () {
30
+ return this.count > 0;
31
+ }
32
+ },
33
+ };
34
+ </script>
35
+
36
+ <style lang="scss">
37
+ @import '../../../assets/palette';
38
+
39
+ .mg-counter-badge {
40
+ background-color: map-get($palette, 'brand');
41
+ color: #fff;
42
+ font-family: 'Ubuntu', sans-serif;
43
+ font-size: 0.75rem;
44
+ font-weight: 600;
45
+ height: 1.125rem;
46
+ min-height: 1.125rem;
47
+ min-width: 1.125rem;
48
+ width: 1.125rem;
49
+ }
50
+ </style>
@@ -2,7 +2,7 @@ import MgIconBadge from './IconBadge.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
- title: 'Components/Icon Badge',
5
+ title: 'Badge/Icon',
6
6
  component: MgIconBadge,
7
7
  // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
8
  argTypes: {
@@ -13,7 +13,7 @@ export default {
13
13
  },
14
14
  theme: {
15
15
  control: { type: 'select' },
16
- options: ['light', 'dark', 'club', 'trial', 'goalkeeper', 'defender', 'midfielder', 'forward', 'success'],
16
+ options: ['light', 'dark', 'tag', 'club', 'trial', 'goalkeeper', 'defender', 'midfielder', 'forward', 'success'],
17
17
  defaultValue: 'light'
18
18
  },
19
19
  default: {
@@ -41,6 +41,5 @@ const Template = (args, { argTypes }) => ({
41
41
  export const Default = Template.bind({});
42
42
  // More on args: https://storybook.js.org/docs/vue/writing-stories/args
43
43
  Default.args = {
44
- default: 'etichetta',
45
- size: 'x-small'
44
+ default: 'etichetta'
46
45
  };
@@ -25,7 +25,7 @@ export default {
25
25
  type: String,
26
26
  default: 'light',
27
27
  validator: function (value) {
28
- return ['light', 'dark', 'club', 'trial', 'goalkeeper', 'defender', 'midfielder', 'forward', 'success'].indexOf(value) !== -1;
28
+ return ['light', 'dark', 'tag', 'club', 'trial', 'goalkeeper', 'defender', 'midfielder', 'forward', 'success'].indexOf(value) !== -1;
29
29
  },
30
30
  },
31
31
  },
@@ -38,6 +38,7 @@ export default {
38
38
  'mg-label--size-normal': this.size === 'normal',
39
39
  'mg-label--theme-light': this.theme === 'light',
40
40
  'mg-label--theme-dark': this.theme === 'dark',
41
+ 'mg-label--theme-tag': this.theme === 'tag',
41
42
  'mg-label--theme-club': this.theme === 'club',
42
43
  'mg-label--theme-trial': this.theme === 'trial',
43
44
  'mg-label--theme-goalkeeper': this.theme === 'goalkeeper',
@@ -97,6 +98,14 @@ export default {
97
98
  color: #fff;
98
99
  }
99
100
 
101
+ &-tag {
102
+ background-color: lighten(map-get($palette, 'brand'), 50%);
103
+ > div {
104
+ background: lighten(map-get($palette, 'brand'), 50%);
105
+ }
106
+ color: map-get($palette, 'brand');
107
+ }
108
+
100
109
  &-club {
101
110
  background: map-get($palette, 'club');
102
111
  > div {
@@ -33,6 +33,18 @@ export default {
33
33
  ],
34
34
  defaultValue: null
35
35
  },
36
+ header: {
37
+ description: "The header content goes here",
38
+ control: {
39
+ type: 'text',
40
+ },
41
+ table: {
42
+ category: 'Slots',
43
+ type: {
44
+ summary: 'html',
45
+ },
46
+ }
47
+ },
36
48
  footer: {
37
49
  description: "The footer content goes here",
38
50
  control: {
@@ -53,6 +65,7 @@ const Template = (args, { argTypes }) => ({
53
65
  props: Object.keys(argTypes),
54
66
  components: { MgVCard },
55
67
  template: `<mg-v-card @click="$emit('click')" v-bind="$props">
68
+ <template v-if="${'header' in args}" v-slot:header>${args.header}</template>
56
69
  <template v-if="${'default' in args}" v-slot>${args.default}</template>
57
70
  <template v-if="${'footer' in args}" v-slot:footer>${args.footer}</template>
58
71
  </mg-v-card>`,
@@ -64,6 +77,13 @@ Default.args = {
64
77
  default: '<div>This is a vertical card.</div><div>What do you think about?</div>'
65
78
  };
66
79
 
80
+ export const Header = Template.bind({});
81
+ // More on args: https://storybook.js.org/docs/vue/writing-stories/args
82
+ Header.args = {
83
+ default: '<div>This is a vertical card.</div><div>What do you think about?</div>',
84
+ header: '<div>The header content goes here</div>'
85
+ };
86
+
67
87
  export const Footer = Template.bind({});
68
88
  // More on args: https://storybook.js.org/docs/vue/writing-stories/args
69
89
  Footer.args = {
@@ -4,12 +4,18 @@
4
4
  :class="classes"
5
5
  @click="onClick"
6
6
  >
7
+ <div
8
+ class="mg-v-card-header"
9
+ v-if="headerVisibility"
10
+ >
11
+ <slot name="header"></slot>
12
+ </div>
7
13
  <div class="mg-v-card-body p-3"><slot></slot></div>
8
14
  <div
9
15
  class="mg-v-card-footer px-3 pb-3"
10
16
  v-if="footerVisibility"
11
17
  >
12
- <div class="mg-v-card-content pt-3">
18
+ <div class="pt-3">
13
19
  <slot name="footer"></slot>
14
20
  </div>
15
21
  </div>
@@ -53,6 +59,9 @@ export default {
53
59
  'mg-v-card--theme-transparent': this.theme === 'transparent',
54
60
  };
55
61
  },
62
+ headerVisibility() {
63
+ return 'header' in this.$slots && !!this.$slots.header;
64
+ },
56
65
  footerVisibility() {
57
66
  return 'footer' in this.$slots && !!this.$slots.footer;
58
67
  }
@@ -75,8 +84,8 @@ export default {
75
84
 
76
85
  &--theme {
77
86
  &-club {
78
- background: map-get($palette, 'club');
79
- color: #fff;
87
+ background: linear-gradient(90deg, #d1efff 0%, #dddafc 99.65%);;
88
+ color: #777;
80
89
  }
81
90
 
82
91
  &-rating {
@@ -111,7 +120,7 @@ export default {
111
120
  }
112
121
 
113
122
  &-footer {
114
- .mg-v-card-content {
123
+ > div {
115
124
  border-top: 1px solid #cecece;
116
125
  }
117
126
  }
@@ -1,4 +1,4 @@
1
- import MgIconBadge from '../../components/icon-badge/IconBadge.vue';
1
+ import MgIconBadge from '../../badge/icon/IconBadge.vue';
2
2
 
3
3
  // More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
4
4
  export default {