@magicgol/polyjuice 0.39.3 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicgol/polyjuice",
3
- "version": "0.39.3",
3
+ "version": "0.40.0",
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: {
@@ -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
  };
@@ -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 {