@everchron/ec-shards 2.1.9 → 2.2.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": "@everchron/ec-shards",
3
- "version": "2.1.9",
3
+ "version": "2.2.0",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -2,14 +2,19 @@
2
2
  <div class="ecs-comment">
3
3
  <div class="ecs-comment-header">
4
4
  <div class="ecs-comment-autor">
5
- <ecs-avatar :name="userName" :image="userImage" :size="30" rounded />
6
- <div class="ecs-comment-meta">
5
+ <ecs-skeleton-loader v-if="loading" type="circle" :width="30" :height="30" />
6
+ <ecs-avatar v-else :name="userName" :image="userImage" :size="30" rounded />
7
+ <div v-if="!loading" class="ecs-comment-meta">
7
8
  <span class="ecs-comment-meta-name">{{userName}}</span>
8
9
  <span class="ecs-comment-meta-time">
9
10
  <!-- @slot Slot for the comment date/time. -->
10
11
  <slot name="commentdate"></slot>
11
12
  </span>
12
13
  </div>
14
+ <div v-else class="ecs-comment-meta loading">
15
+ <ecs-skeleton-loader type="single" :line-height="3" :width="50" />
16
+ <ecs-skeleton-loader type="single" :line-height="2" :width="60" />
17
+ </div>
13
18
  </div>
14
19
  <div v-if="canEdit" class="ecs-comment-actions">
15
20
  <ecs-button @click="$emit('edit', $event)" type="secondary" size="sml" icon="edit" icon-only title="Edit Comment" />
@@ -17,11 +22,13 @@
17
22
  </div>
18
23
  </div>
19
24
 
20
- <ecs-formatted v-if="!$slots.editform" class="ecs-comment-body">
25
+ <ecs-formatted v-if="!$slots.editform && !loading" class="ecs-comment-body">
21
26
  <!-- @slot Comment text (rich text). -->
22
27
  <slot></slot>
23
28
  </ecs-formatted>
24
29
 
30
+ <ecs-skeleton-loader v-else-if="loading" type="multi" :count="2" class="ecs-comment-body" />
31
+
25
32
  <div v-else class="ecs-comment-edit">
26
33
  <!-- @slot Contains the form to edit the comment. When this slot is not empty, the form will show up instead of the comment text. -->
27
34
  <slot name="editform"></slot>
@@ -33,9 +40,10 @@
33
40
  import EcsAvatar from '../avatar/avatar'
34
41
  import EcsButton from '../button/button'
35
42
  import EcsFormatted from '../formatted/formatted'
43
+ import EcsSkeletonLoader from '../skeleton-loader/skeleton-loader'
36
44
 
37
45
  export default {
38
- components: { EcsAvatar, EcsButton, EcsFormatted },
46
+ components: { EcsAvatar, EcsButton, EcsFormatted, EcsSkeletonLoader },
39
47
  props: {
40
48
  /** Name of the user that is the comment author. */
41
49
  userName: {
@@ -51,6 +59,11 @@
51
59
  canEdit: {
52
60
  type: Boolean,
53
61
  default: false
62
+ },
63
+ /** Shows the whole comment in skeleton loading state. */
64
+ loading: {
65
+ type: Boolean,
66
+ default: false
54
67
  }
55
68
  }
56
69
  };
@@ -65,19 +78,14 @@
65
78
  &-header{
66
79
  display: flex;
67
80
  align-items: center;
68
- justify-content: space-between;
69
81
  margin-bottom: 10px;
70
82
  }
71
83
 
72
- &-from{
73
- font-size: $type-scale-2-font-size;
74
- color: $color-gray-8;
75
- }
76
-
77
84
  &-autor{
78
85
  display: flex;
79
86
  text-decoration: none;
80
87
  color: $color-blue-10;
88
+ flex: 1;
81
89
 
82
90
  &:hover{
83
91
  color: darken($color-blue-10, 5%);
@@ -89,13 +97,21 @@
89
97
 
90
98
  &-name{
91
99
  font-size: $type-scale-3-font-size;
100
+ line-height: $type-scale-3-line-height;
92
101
  font-weight: $font-weight-medium;
93
102
  display: block;
94
103
  }
95
104
 
96
105
  &-time{
97
106
  font-size: $type-scale-2-font-size;
107
+ line-height: $type-scale-2-line-height;
98
108
  color: $color-gray-8;
109
+ display: block;
110
+ }
111
+
112
+ &.loading{
113
+ width: 100%;
114
+ max-width: 200px;
99
115
  }
100
116
  }
101
117
 
@@ -6,9 +6,11 @@
6
6
 
7
7
 
8
8
  <style lang="scss">
9
+ @import "../../tokens/build/scss/tokens.scss";
10
+
9
11
  .ecs-comment-list{
10
- > div{
11
- margin-bottom: 30px;
12
+ > .ecs-comment{
13
+ margin-bottom: $spacing-20;
12
14
  }
13
15
  }
14
16
  </style>
@@ -296,6 +296,7 @@
296
296
  &-mono{
297
297
  font-family: $font-family-monospace;
298
298
  font-size: $type-scale-2-font-size;
299
+ line-height: $type-scale-3-line-height;
299
300
  }
300
301
 
301
302
  &-escape{
@@ -280,7 +280,7 @@
280
280
  }
281
281
 
282
282
  &.control{
283
- padding: 11px 12px;
283
+ padding: 10px 12px;
284
284
 
285
285
  .ecs-form-check{
286
286
  margin-bottom: 0;
@@ -292,6 +292,7 @@
292
292
 
293
293
  .ecs-switch-wrapper{
294
294
  margin: -7px 0;
295
+ padding: 5px 0;
295
296
  }
296
297
 
297
298
  .after{
@@ -1,9 +1,13 @@
1
1
  <template>
2
- <div v-if="type === 'rect'" class="skeleton skeleton-rectangle" :style="{ width: width + 'px', 'height': height + 'px' }" />
2
+ <div v-if="type === 'rect' || type === 'circle'" class="skeleton" :class="rectClass" :style="{ width: width + 'px', 'height': height + 'px' }" />
3
3
  <div v-else-if="type === 'multi'" class="skeletons">
4
- <div v-for="n in parseInt(count)" :key="n" class="skeleton skeleton-single" />
4
+ <div v-for="n in parseInt(count)" :key="n" class="skeleton-wrap" :class="'skeleton-line-height-'+lineHeight">
5
+ <div class="skeleton skeleton-single" />
6
+ </div>
7
+ </div>
8
+ <div v-else class="skeleton-wrap" :class="'skeleton-line-height-'+lineHeight">
9
+ <div class="skeleton skeleton-single" :style="{ width: width + '%' }" />
5
10
  </div>
6
- <div v-else class="skeleton skeleton-single" :style="{ width: width + '%' }" />
7
11
  </template>
8
12
 
9
13
  <script>
@@ -12,7 +16,7 @@
12
16
  /** Determines the type of skeleton shape: `single` replicates a single line of text, `multi` a multi line text, and `rect` a generic rectangle shape. */
13
17
  type: {
14
18
  type: String,
15
- validator: v => ['single', 'multi', 'rect'].includes(v),
19
+ validator: v => ['single', 'multi', 'rect', 'circle'].includes(v),
16
20
  default: 'single'
17
21
  },
18
22
  /** Only used together with the `multi` type. Determines the amount of text lines. */
@@ -25,10 +29,24 @@
25
29
  type: Number,
26
30
  default: 20
27
31
  },
28
- /** Sets the height of the `single` type in percentage. Sets the width of the `rect` type in pixels. */
32
+ /** Sets the height of the `rect` and `circle` type in pixels. */
29
33
  height: {
30
34
  type: Number,
31
35
  default: 20
36
+ },
37
+ /** Aligns the height and size of the single & multi types with our common line-height type scales. */
38
+ lineHeight: {
39
+ type: Number,
40
+ validator: v => [1, 2, 3, 4, 5, 6].includes(v),
41
+ default: 2
42
+ }
43
+ },
44
+
45
+ computed: {
46
+ rectClass() {
47
+ if (this.type && this.type !== '')
48
+ return `skeleton-${this.type}`
49
+ return this.type
32
50
  }
33
51
  }
34
52
  }
@@ -44,19 +62,76 @@
44
62
  }
45
63
  }
46
64
 
65
+ .skeleton-wrap{
66
+ width: 100%;
67
+ }
68
+
69
+ .skeleton-line-height{
70
+ &-1{
71
+ padding: 5px 0;
72
+
73
+ .skeleton{
74
+ height: 4px;
75
+ }
76
+ }
77
+
78
+ &-2{
79
+ padding: 5px 0;
80
+
81
+ .skeleton{
82
+ height: 6px;
83
+ }
84
+ }
85
+
86
+ &-3{
87
+ padding: 6px 0;
88
+
89
+ .skeleton{
90
+ height: 8px;
91
+ }
92
+ }
93
+
94
+ &-4{
95
+ padding: 8px 0;
96
+
97
+ .skeleton{
98
+ height: 8px;
99
+ }
100
+ }
101
+
102
+ &-5{
103
+ padding: 9px 0;
104
+
105
+ .skeleton{
106
+ height: 10px;
107
+ }
108
+ }
109
+
110
+ &-6{
111
+ padding: 10px 0;
112
+
113
+ .skeleton{
114
+ height: 12px;
115
+ }
116
+ }
117
+ }
118
+
47
119
  .skeleton{
48
- border-radius: $border-radius-medium;
120
+ border-radius: 16px;
49
121
  background: $color-gray-3;
50
122
  width: 100%;
51
- height: 6px;
52
123
  overflow: hidden;
53
124
  position: relative;
54
125
  cursor: wait;
55
126
 
56
- &-rectangle{
127
+ &-rect{
57
128
  border-radius: $border-radius-small;
58
129
  }
59
130
 
131
+ &-circle{
132
+ border-radius: 100%;
133
+ }
134
+
60
135
  &:after{
61
136
  background: linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.8),hsla(0,0%,100%,0));
62
137
  animation: skeleton 2.5s infinite;
@@ -74,13 +149,8 @@
74
149
  .skeletons{
75
150
  cursor: wait;
76
151
 
77
- .skeleton{
78
- margin-bottom: 15px;
79
-
80
- &:last-child{
81
- width: 65%;
82
- margin-bottom: 0;
83
- }
152
+ .skeleton-wrap:last-child{
153
+ width: 65%;
84
154
  }
85
155
  }
86
156
  </style>
@@ -6,6 +6,19 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 2.2.0 (4 November 2022)
10
+
11
+ ### Features
12
+
13
+ - Added `circle` variant to skeleton loader component
14
+ - Added `loading` state to comment component
15
+ - Added line height scales to EcsSkeletonLoader component, to match common text line heights
16
+
17
+ ### Fixes
18
+
19
+ - Style fixes in EcsCommentsList component
20
+ - Fixed line height in EcsDataListItem
21
+
9
22
  ## Version 2.1.9 (1 November 2022)
10
23
 
11
24
  ### Features
@@ -25,3 +25,13 @@ export const commentEdit = () => ({
25
25
  </ecs-comment>
26
26
  </ecs-comment-list>`,
27
27
  });
28
+
29
+ export const commentLoading = () => ({
30
+ components: { EcsCommentList, EcsComment },
31
+ template: `<ecs-comment-list>
32
+ <ecs-comment loading user-name="Ivo Mynttinen">
33
+ This is my comment.
34
+ <template slot="commentdate">Apr 13, 2021 at 3:42 pm</template>
35
+ </ecs-comment>
36
+ </ecs-comment-list>`,
37
+ });
@@ -10,6 +10,18 @@ export const singleLine = () => ({
10
10
  template: `<ecs-skeleton-loader type="single" />`,
11
11
  });
12
12
 
13
+ export const typeScales = () => ({
14
+ components: { EcsSkeletonLoader },
15
+ template: `<main>
16
+ <ecs-skeleton-loader type="single" :line-height="1" />
17
+ <ecs-skeleton-loader type="single" :line-height="2" />
18
+ <ecs-skeleton-loader type="single" :line-height="3" />
19
+ <ecs-skeleton-loader type="single" :line-height="4" />
20
+ <ecs-skeleton-loader type="single" :line-height="5" />
21
+ <ecs-skeleton-loader type="single" :line-height="6" />
22
+ </main>`,
23
+ });
24
+
13
25
  export const multiLine = () => ({
14
26
  components: { EcsSkeletonLoader },
15
27
  template: `<ecs-skeleton-loader type="multi" :count="4" />`,
@@ -19,3 +31,8 @@ export const rectangle = () => ({
19
31
  components: { EcsSkeletonLoader },
20
32
  template: `<ecs-skeleton-loader type="rect" :width="22" :height="22" />`,
21
33
  });
34
+
35
+ export const circle = () => ({
36
+ components: { EcsSkeletonLoader },
37
+ template: `<ecs-skeleton-loader type="circle" :width="22" :height="22" />`,
38
+ });