@internetarchive/collection-browser 0.2.4-alpha.4 → 0.2.5

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.
Files changed (41) hide show
  1. package/dist/src/sort-filter-bar/sort-filter-bar.js +1 -1
  2. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  3. package/dist/src/tiles/grid/account-tile.d.ts +0 -1
  4. package/dist/src/tiles/grid/account-tile.js +78 -45
  5. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  6. package/dist/src/tiles/grid/icons/account.d.ts +1 -0
  7. package/dist/src/tiles/grid/icons/account.js +12 -0
  8. package/dist/src/tiles/grid/icons/account.js.map +1 -0
  9. package/dist/src/{assets/img → tiles/grid}/icons/favorite-filled.d.ts +0 -0
  10. package/dist/src/{assets/img → tiles/grid}/icons/favorite-filled.js +0 -0
  11. package/dist/src/{assets/img → tiles/grid}/icons/favorite-filled.js.map +1 -1
  12. package/dist/src/{assets/img → tiles/grid}/icons/reviews.d.ts +0 -0
  13. package/dist/src/{assets/img → tiles/grid}/icons/reviews.js +0 -0
  14. package/dist/src/{assets/img → tiles/grid}/icons/reviews.js.map +1 -1
  15. package/dist/src/{assets/img → tiles/grid}/icons/upload.d.ts +0 -0
  16. package/dist/src/{assets/img → tiles/grid}/icons/upload.js +0 -0
  17. package/dist/src/{assets/img → tiles/grid}/icons/upload.js.map +1 -1
  18. package/dist/src/tiles/grid/icons/views.d.ts +2 -0
  19. package/dist/src/{assets/img → tiles/grid}/icons/views.js +1 -1
  20. package/dist/src/tiles/grid/icons/views.js.map +1 -0
  21. package/dist/src/tiles/grid/item-tile.d.ts +0 -1
  22. package/dist/src/tiles/grid/item-tile.js +122 -49
  23. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  24. package/dist/src/tiles/mediatype-icon.js +1 -19
  25. package/dist/src/tiles/mediatype-icon.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/sort-filter-bar/sort-filter-bar.ts +1 -1
  28. package/src/tiles/grid/account-tile.ts +77 -44
  29. package/src/tiles/grid/icons/account.ts +12 -0
  30. package/src/{assets/img → tiles/grid}/icons/favorite-filled.ts +0 -0
  31. package/src/{assets/img → tiles/grid}/icons/reviews.ts +0 -0
  32. package/src/{assets/img → tiles/grid}/icons/upload.ts +0 -0
  33. package/src/{assets/img → tiles/grid}/icons/views.ts +1 -1
  34. package/src/tiles/grid/item-tile.ts +123 -50
  35. package/src/tiles/mediatype-icon.ts +1 -19
  36. package/dist/src/assets/img/icons/views.d.ts +0 -1
  37. package/dist/src/assets/img/icons/views.js.map +0 -1
  38. package/dist/src/tiles/grid/tile-stats.d.ts +0 -10
  39. package/dist/src/tiles/grid/tile-stats.js +0 -133
  40. package/dist/src/tiles/grid/tile-stats.js.map +0 -1
  41. package/src/tiles/grid/tile-stats.ts +0 -131
@@ -1,13 +1,16 @@
1
1
  /* eslint-disable import/no-duplicates */
2
2
  import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';
3
3
  import { customElement, property } from 'lit/decorators.js';
4
- import { ifDefined } from 'lit/directives/if-defined.js';
5
4
 
6
5
  import { TileModel } from '../../models';
6
+ import { formatCount } from '../../utils/format-count';
7
+
8
+ import { favoriteFilledIcon } from './icons/favorite-filled';
9
+ import { reviewsIcon } from './icons/reviews';
10
+ import viewsIcon from './icons/views';
7
11
 
8
12
  import '../mediatype-icon';
9
13
  import '../item-image';
10
- import './tile-stats';
11
14
 
12
15
  @customElement('item-tile')
13
16
  export class ItemTile extends LitElement {
@@ -16,112 +19,182 @@ export class ItemTile extends LitElement {
16
19
  @property({ type: String }) baseImageUrl?: string;
17
20
 
18
21
  render() {
19
- const itemTitle = this.model?.title;
22
+ const itemTitle = this.model?.title || nothing;
20
23
  const itemCreator = this.model?.creator;
21
24
  return html`
22
- <div class="container">
23
- <div class="item-info">
24
- <div id="title">
25
- <h1 class="truncated" title=${ifDefined(
26
- itemTitle
27
- )}>${itemTitle}</h1>
28
- </div>
29
-
30
- <div id="image">
31
- <item-image
32
- .model=${this.model}
33
- .baseImageUrl=${this.baseImageUrl}>
25
+ <div id="container">
26
+ <div id="title-image-container">
27
+ <h1 id="item-title" title=${itemTitle}>${itemTitle}</h1>
28
+ <div id="item-image-container">
29
+ <item-image .model=${this.model} .baseImageUrl=${this.baseImageUrl}>
34
30
  </item-image>
35
31
  </div>
36
- <div class="created-by truncated">
37
- ${itemCreator ? html`<span>by&nbsp;${itemCreator}</span>` : nothing}
32
+ <div class="item-creator">
33
+ <div class="truncated">
34
+ ${itemCreator
35
+ ? html`<span>by&nbsp;${itemCreator}</span>`
36
+ : nothing}
37
+ </div>
38
38
  </div>
39
39
  </div>
40
40
 
41
- <tile-stats
42
- .mediatype=${this.model?.mediatype}
43
- .viewCount=${this.model?.viewCount}
44
- .favCount=${this.model?.favCount}
45
- .commentCount=${this.model?.commentCount}>
46
- </tile-stats>
41
+ <div class="hr"></div>
42
+
43
+ <div id="item-stats-container">
44
+ <div id="stats-holder">
45
+ <div class="col">
46
+ <mediatype-icon
47
+ .mediatype=${this.model?.mediatype}
48
+ .collection=${this.model?.collections}
49
+ style="--iconHeight:25px; --iconWidth:25px;"
50
+ >
51
+ </mediatype-icon>
52
+ </div>
53
+ <div class="col">
54
+ ${viewsIcon}
55
+ <p class="status-text">
56
+ ${formatCount(this.model?.viewCount, 'short', 'short')}
57
+ </p>
58
+ </div>
59
+ <div class="col">
60
+ ${favoriteFilledIcon}
61
+ <p class="status-text">
62
+ ${formatCount(this.model?.itemCount, 'short', 'short')}
63
+ </p>
64
+ </div>
65
+ <div class="col">
66
+ ${reviewsIcon}
67
+ <p class="status-text">
68
+ ${formatCount(this.model?.favCount, 'short', 'short')}
69
+ </p>
70
+ </div>
71
+ </div>
47
72
  </div>
48
73
  </div>
49
74
  `;
50
75
  }
51
76
 
52
77
  static get styles(): CSSResultGroup {
78
+ const cornerRadiusCss = css`var(--collectionTileCornerRadius, 4px)`;
79
+
53
80
  return css`
54
- .container {
81
+ #container {
55
82
  background-color: #ffffff;
56
- border-radius: var(--collectionTileCornerRadius, 4px);
83
+ border-radius: ${cornerRadiusCss};
57
84
  box-shadow: 1px 1px 2px 0px;
58
85
  display: flex;
59
86
  flex-direction: column;
60
87
  height: 100%;
88
+ position: relative;
61
89
  }
62
90
 
63
- .item-info {
64
- padding: 5px 5px 0 5px;
65
- flex-grow: 1;
91
+ #title-image-container {
92
+ display: flex;
93
+ flex: 1;
94
+ flex-direction: column;
95
+ padding: 0.5rem 0.5rem 0 0.5rem;
66
96
  }
67
97
 
68
- #title {
69
- flex-shrink: 0;
98
+ #item-title {
99
+ color: #2c2c2c;
100
+ font-size: 1.6rem;
101
+ text-align: center;
102
+ margin-top: 0rem;
103
+ margin-bottom: 0.5rem;
104
+ overflow: hidden;
105
+ text-overflow: ellipsis;
106
+ display: -webkit-box;
107
+ -webkit-line-clamp: 2;
108
+ -webkit-box-orient: vertical;
109
+ line-height: 2rem;
110
+ height: 4rem;
70
111
  }
71
112
 
72
- #image {
113
+ #item-image-container {
73
114
  display: flex;
74
115
  justify-content: center;
75
116
  flex: 1;
76
- height: 16rem;
77
117
  }
78
118
 
79
119
  .hidden {
80
120
  display: none;
81
121
  }
82
122
 
83
- .container:hover > .item-info > #title > .truncated {
123
+ #container:hover > #title-image-container > .item-title {
84
124
  text-decoration: underline;
85
125
  }
86
126
 
87
127
  /** this is a workaround for Safari 15 where the hover effects are not working */
88
- #title:hover > .truncated {
128
+ #title-image-container:hover > #item-title {
89
129
  text-decoration: underline;
90
130
  }
91
131
 
92
- .created-by {
132
+ #container:hover > #item-title {
133
+ background-color: #fcfcfc;
134
+ }
135
+
136
+ .item-creator {
93
137
  display: flex;
94
138
  justify-content: center;
95
139
  align-items: flex-end; /* Important to start text from bottom */
96
140
  height: 3rem;
97
141
  padding-top: 1rem;
98
- margin-top: 5px;
99
142
  }
100
143
 
101
144
  .truncated {
102
145
  flex: 1;
103
- color: #2c2c2c;
104
146
  min-width: 0; /* Important for long words! */
105
- text-align: center;
106
- line-height: 2rem;
107
- text-overflow: ellipsis;
108
- overflow: hidden;
109
- word-wrap: break-word;
110
- -webkit-line-clamp: 2;
111
- -webkit-box-orient: vertical;
112
147
  }
113
148
 
114
149
  .truncated span {
115
150
  font-size: 1.4rem;
151
+ color: #2c2c2c;
152
+ -webkit-line-clamp: 2;
153
+ text-overflow: ellipsis;
154
+ overflow: hidden;
116
155
  display: -webkit-box;
156
+ -webkit-box-orient: vertical;
157
+ word-wrap: break-word;
158
+ line-height: 2rem;
159
+ text-align: center;
117
160
  }
118
161
 
119
- h1.truncated {
120
- margin-top: 0rem;
121
- margin-bottom: 0.5rem;
122
- font-size: 1.6rem;
123
- height: 4rem;
124
- display: -webkit-box;
162
+ .hr {
163
+ border: 0.5px solid #ccc;
164
+ }
165
+
166
+ #item-stats-container {
167
+ align-items: center;
168
+ display: flex;
169
+ height: 5.5rem;
170
+ padding-left: 1rem;
171
+ padding-right: 0.5rem;
172
+ }
173
+
174
+ #stats-holder {
175
+ align-items: center;
176
+ display: flex;
177
+ flex: 1;
178
+ justify-content: space-evenly;
179
+ text-align: center;
180
+ width: 100%;
181
+ }
182
+
183
+ svg {
184
+ height: 10px;
185
+ width: 10px;
186
+ }
187
+
188
+ .status-text {
189
+ font-size: 14px;
190
+ color: #2c2c2c;
191
+ margin: auto;
192
+ display: block;
193
+ text-align: center;
194
+ }
195
+
196
+ .col {
197
+ width: 25%;
125
198
  }
126
199
  `;
127
200
  }
@@ -43,20 +43,13 @@ export class MediatypeIcon extends LitElement {
43
43
  style="--iconFillColor: ${config.color}"
44
44
  >
45
45
  ${config.icon}
46
- <p class="status-text">
47
- <span class="sr-only">${config.text} icon</span>
48
- ${config.text}
49
- </p>
46
+ <p class="status-text">${config.text}</p>
50
47
  </div>
51
48
  `;
52
49
  }
53
50
 
54
51
  static get styles(): CSSResultGroup {
55
52
  return css`
56
- #icon {
57
- height: var(--iconHeight, 25px);
58
- }
59
-
60
53
  .status-text {
61
54
  font-size: 14px;
62
55
  color: #2c2c2c;
@@ -77,17 +70,6 @@ export class MediatypeIcon extends LitElement {
77
70
  .fill-color {
78
71
  fill: var(--iconFillColor, '#000000');
79
72
  }
80
-
81
- .sr-only {
82
- position: absolute;
83
- width: 1px;
84
- height: 1px;
85
- padding: 0;
86
- margin: -1px;
87
- overflow: hidden;
88
- clip: rect(0, 0, 0, 0);
89
- border: 0;
90
- }
91
73
  `;
92
74
  }
93
75
  }
@@ -1 +0,0 @@
1
- export declare const viewsIcon: import("lit-html").TemplateResult<2>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"views.js","sourceRoot":"","sources":["../../../../../src/assets/img/icons/views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;;;;;;;CAQ3B,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const viewsIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"m98 50.5704143c-.2830293-.471515-.671154-1.1088947-1.1643742-1.9121392s-1.6003642-2.3617474-3.3214321-4.6755089c-1.7210678-2.3137614-3.522258-4.5325939-5.4035703-6.6564975-1.8813124-2.1239037-4.2828993-4.473133-7.2047606-7.0476881-2.9218612-2.5745551-5.8895067-4.7933876-8.9029363-6.6564976-3.0134295-1.86311-6.4628491-3.4330878-10.3482587-4.7099336-3.8854095-1.2768458-7.7822651-1.9142256-11.6905667-1.9121443-3.9083017.0020914-7.8051573.6154781-11.6905668 1.8401652-3.8854096 1.2246871-7.3702078 2.8301329-10.4543947 4.8163375-3.0841869 1.9862045-6.0278997 4.1695691-8.8311384 6.5500937s-5.2048256 4.7652219-7.2047605 7.1540919c-1.99993501 2.38887-3.75430043 4.5722346-5.26309632 6.5500938s-2.63883199 3.583305-3.39010829 4.8163374l-1.13003609 1.8401602c.2830293.4715149.67115403 1.1088946 1.16437421 1.9121391.49322017.8032445 1.5878776 2.3617475 3.28397229 4.6755089s3.47439274 4.521119 5.3348942 6.6220728c1.8605014 2.1009538 4.2506422 4.4387083 7.1704224 7.0132633 2.9197801 2.5745551 5.8874256 4.7819127 8.9029363 6.6220729 3.0155106 1.8401601 6.4774168 3.398663 10.3857184 4.6755088 3.9083017 1.2768458 7.8176438 1.9142256 11.7280266 1.9121443 3.9103827-.0020914 7.7957922-.6154781 11.6562286-1.8401652s7.3337886-2.818658 10.4200566-4.7819127 6.0299808-4.1351444 8.8311384-6.515669 5.2152311-4.7652219 7.2422203-7.1540919 3.8052873-4.5607597 5.3348942-6.515669c1.5296068-1.9549093 2.6721295-3.5488802 3.427568-4.7819127zm-24.5142913 0c0 6.467683-2.3079374 12.0152859-6.9238123 16.6428087s-10.1495139 6.9412843-16.600917 6.9412843c-6.4992683 0-12.0453939-2.3137615-16.6383767-6.9412843s-6.8894742-10.1751257-6.8894742-16.6428087 2.2964914-12.003811 6.8894742-16.608384 10.1391084-6.9068595 16.6383767-6.9068595c6.4534842 0 11.9871232 2.3022865 16.600917 6.9068595s6.9217312 10.140701 6.9238123 16.608384zm-23.5247293-10.552755c2.8261308 0 5.2870289 1.0619518 7.3826944 3.1858555 2.0956655 2.1239036 3.1434982 4.5795368 3.1434982 7.3668995 0 2.8332624-1.0478327 5.2888956-3.1434982 7.3668995-2.0956655 2.078004-4.5565636 3.1170059-7.3826944 3.1170059-2.873996 0-5.3348941-1.0264838-7.3826944-3.0794516-2.0478002-2.0529677-3.0717003-4.5200758-3.0717003-7.4013243 0-2.8332624 1.0239001-5.3003705 3.0717003-7.4013243 2.0478003-2.1009538 4.5086984-3.1514307 7.3826944-3.1514307z\"\n fill=\"#333\"\n />\n <title>Eye icon</title>\n </svg>\n`;\n"]}
@@ -1,10 +0,0 @@
1
- import { CSSResultGroup, LitElement } from 'lit';
2
- export declare class TileStats extends LitElement {
3
- mediatype?: string;
4
- itemCount?: number;
5
- viewCount?: number;
6
- favCount?: number;
7
- commentCount?: number;
8
- render(): import("lit-html").TemplateResult<1>;
9
- static get styles(): CSSResultGroup;
10
- }
@@ -1,133 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { css, html, LitElement } from 'lit';
3
- import { customElement, property } from 'lit/decorators.js';
4
- import { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';
5
- import { reviewsIcon } from '../../assets/img/icons/reviews';
6
- import { uploadIcon } from '../../assets/img/icons/upload';
7
- import { viewsIcon } from '../../assets/img/icons/views';
8
- import { formatCount } from '../../utils/format-count';
9
- let TileStats = class TileStats extends LitElement {
10
- render() {
11
- return html `
12
- <div class="item-stats">
13
- <p class="sr-only">
14
- ${this.mediatype === 'account' ? 'Account' : 'Item'} Stats:
15
- </p>
16
- <ul id="stats-row">
17
- <li class="col">
18
- <mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>
19
- </li>
20
- <li class="col">
21
- ${this.mediatype === 'account' ? uploadIcon : viewsIcon}
22
- <p class="status-text">
23
- <span class="sr-only">
24
- ${this.mediatype === 'account' ? 'Uploads' : 'Views'} count:
25
- </span>
26
- ${formatCount(this.mediatype === 'account' ? this.itemCount : this.viewCount, 'short', 'short')}
27
- </p>
28
- </li>
29
- <li class="col">
30
- ${favoriteFilledIcon}
31
- <p class="status-text">
32
- <span class="sr-only">Favorites count:</span>
33
- ${formatCount(this.favCount, 'short', 'short')}
34
- </p>
35
- </li>
36
- <li class="col">
37
- ${reviewsIcon}
38
- <p class="status-text">
39
- <span class="sr-only">Reviews count:</span>
40
- ${formatCount(this.commentCount, 'short', 'short')}
41
- </p>
42
- </li>
43
- </ul>
44
- </div>
45
- `;
46
- }
47
- static get styles() {
48
- return css `
49
- mediatype-icon {
50
- --iconHeight: 25px;
51
- --iconWidth: 25px;
52
- }
53
-
54
- ul {
55
- all: unset; // unset all property values
56
- list-style-type: none; // remove default list-style
57
- }
58
-
59
- li {
60
- list-style-type: none; // remove default list-style
61
- }
62
-
63
- .item-stats {
64
- height: 35px;
65
- }
66
-
67
- #stats-row {
68
- border-top: 1px solid #bbb;
69
- align-items: center;
70
- display: flex;
71
- flex: 1;
72
- justify-content: space-evenly;
73
- text-align: center;
74
- width: 100%;
75
- padding-top: 5px;
76
- padding-bottom: 5px;
77
- }
78
-
79
- .sr-only {
80
- position: absolute;
81
- width: 1px;
82
- height: 1px;
83
- padding: 0;
84
- margin: -1px;
85
- overflow: hidden;
86
- clip: rect(0, 0, 0, 0);
87
- border: 0;
88
- }
89
-
90
- .col {
91
- width: 25%;
92
- height: 25px;
93
- }
94
-
95
- svg {
96
- height: 10px;
97
- width: 10px;
98
- display: block;
99
- margin: auto;
100
- }
101
-
102
- .status-text {
103
- font-size: 14px;
104
- height: 15px;
105
- color: #2c2c2c;
106
- line-height: 20px;
107
- margin: auto;
108
- display: block;
109
- text-align: center;
110
- }
111
- `;
112
- }
113
- };
114
- __decorate([
115
- property({ type: String })
116
- ], TileStats.prototype, "mediatype", void 0);
117
- __decorate([
118
- property({ type: Number })
119
- ], TileStats.prototype, "itemCount", void 0);
120
- __decorate([
121
- property({ type: Number })
122
- ], TileStats.prototype, "viewCount", void 0);
123
- __decorate([
124
- property({ type: Number })
125
- ], TileStats.prototype, "favCount", void 0);
126
- __decorate([
127
- property({ type: Number })
128
- ], TileStats.prototype, "commentCount", void 0);
129
- TileStats = __decorate([
130
- customElement('tile-stats')
131
- ], TileStats);
132
- export { TileStats };
133
- //# sourceMappingURL=tile-stats.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tile-stats.js","sourceRoot":"","sources":["../../../../src/tiles/grid/tile-stats.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,UAAU;IAWvC,MAAM;QACJ,OAAO,IAAI,CAAA;;;YAGH,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;;;;yCAIpB,IAAI,CAAC,SAAS;;;cAGzC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;;;kBAGjD,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;;gBAEpD,WAAW,CACX,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAC9D,OAAO,EACP,OAAO,CACR;;;;cAID,kBAAkB;;;gBAGhB,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;;;;cAI9C,WAAW;;;gBAGT,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC;;;;;KAK3D,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+DT,CAAC;IACJ,CAAC;CACF,CAAA;AAtH6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AATvC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAuHrB;SAvHY,SAAS","sourcesContent":["import { css, CSSResultGroup, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';\nimport { reviewsIcon } from '../../assets/img/icons/reviews';\nimport { uploadIcon } from '../../assets/img/icons/upload';\nimport { viewsIcon } from '../../assets/img/icons/views';\n\nimport { formatCount } from '../../utils/format-count';\n\n@customElement('tile-stats')\nexport class TileStats extends LitElement {\n @property({ type: String }) mediatype?: string;\n\n @property({ type: Number }) itemCount?: number;\n\n @property({ type: Number }) viewCount?: number;\n\n @property({ type: Number }) favCount?: number;\n\n @property({ type: Number }) commentCount?: number;\n\n render() {\n return html`\n <div class=\"item-stats\">\n <p class=\"sr-only\">\n ${this.mediatype === 'account' ? 'Account' : 'Item'} Stats:\n </p>\n <ul id=\"stats-row\">\n <li class=\"col\">\n <mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>\n </li>\n <li class=\"col\">\n ${this.mediatype === 'account' ? uploadIcon : viewsIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">\n ${this.mediatype === 'account' ? 'Uploads' : 'Views'} count:\n </span>\n ${formatCount(\n this.mediatype === 'account' ? this.itemCount : this.viewCount,\n 'short',\n 'short'\n )}\n </p>\n </li>\n <li class=\"col\">\n ${favoriteFilledIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">Favorites count:</span>\n ${formatCount(this.favCount, 'short', 'short')}\n </p>\n </li>\n <li class=\"col\">\n ${reviewsIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">Reviews count:</span>\n ${formatCount(this.commentCount, 'short', 'short')}\n </p>\n </li>\n </ul>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return css`\n mediatype-icon {\n --iconHeight: 25px;\n --iconWidth: 25px;\n }\n\n ul {\n all: unset; // unset all property values\n list-style-type: none; // remove default list-style\n }\n\n li {\n list-style-type: none; // remove default list-style\n }\n\n .item-stats {\n height: 35px;\n }\n\n #stats-row {\n border-top: 1px solid #bbb;\n align-items: center;\n display: flex;\n flex: 1;\n justify-content: space-evenly;\n text-align: center;\n width: 100%;\n padding-top: 5px;\n padding-bottom: 5px;\n }\n\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n }\n\n .col {\n width: 25%;\n height: 25px;\n }\n\n svg {\n height: 10px;\n width: 10px;\n display: block;\n margin: auto;\n }\n\n .status-text {\n font-size: 14px;\n height: 15px;\n color: #2c2c2c;\n line-height: 20px;\n margin: auto;\n display: block;\n text-align: center;\n }\n `;\n }\n}\n"]}
@@ -1,131 +0,0 @@
1
- import { css, CSSResultGroup, html, LitElement } from 'lit';
2
- import { customElement, property } from 'lit/decorators.js';
3
-
4
- import { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';
5
- import { reviewsIcon } from '../../assets/img/icons/reviews';
6
- import { uploadIcon } from '../../assets/img/icons/upload';
7
- import { viewsIcon } from '../../assets/img/icons/views';
8
-
9
- import { formatCount } from '../../utils/format-count';
10
-
11
- @customElement('tile-stats')
12
- export class TileStats extends LitElement {
13
- @property({ type: String }) mediatype?: string;
14
-
15
- @property({ type: Number }) itemCount?: number;
16
-
17
- @property({ type: Number }) viewCount?: number;
18
-
19
- @property({ type: Number }) favCount?: number;
20
-
21
- @property({ type: Number }) commentCount?: number;
22
-
23
- render() {
24
- return html`
25
- <div class="item-stats">
26
- <p class="sr-only">
27
- ${this.mediatype === 'account' ? 'Account' : 'Item'} Stats:
28
- </p>
29
- <ul id="stats-row">
30
- <li class="col">
31
- <mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>
32
- </li>
33
- <li class="col">
34
- ${this.mediatype === 'account' ? uploadIcon : viewsIcon}
35
- <p class="status-text">
36
- <span class="sr-only">
37
- ${this.mediatype === 'account' ? 'Uploads' : 'Views'} count:
38
- </span>
39
- ${formatCount(
40
- this.mediatype === 'account' ? this.itemCount : this.viewCount,
41
- 'short',
42
- 'short'
43
- )}
44
- </p>
45
- </li>
46
- <li class="col">
47
- ${favoriteFilledIcon}
48
- <p class="status-text">
49
- <span class="sr-only">Favorites count:</span>
50
- ${formatCount(this.favCount, 'short', 'short')}
51
- </p>
52
- </li>
53
- <li class="col">
54
- ${reviewsIcon}
55
- <p class="status-text">
56
- <span class="sr-only">Reviews count:</span>
57
- ${formatCount(this.commentCount, 'short', 'short')}
58
- </p>
59
- </li>
60
- </ul>
61
- </div>
62
- `;
63
- }
64
-
65
- static get styles(): CSSResultGroup {
66
- return css`
67
- mediatype-icon {
68
- --iconHeight: 25px;
69
- --iconWidth: 25px;
70
- }
71
-
72
- ul {
73
- all: unset; // unset all property values
74
- list-style-type: none; // remove default list-style
75
- }
76
-
77
- li {
78
- list-style-type: none; // remove default list-style
79
- }
80
-
81
- .item-stats {
82
- height: 35px;
83
- }
84
-
85
- #stats-row {
86
- border-top: 1px solid #bbb;
87
- align-items: center;
88
- display: flex;
89
- flex: 1;
90
- justify-content: space-evenly;
91
- text-align: center;
92
- width: 100%;
93
- padding-top: 5px;
94
- padding-bottom: 5px;
95
- }
96
-
97
- .sr-only {
98
- position: absolute;
99
- width: 1px;
100
- height: 1px;
101
- padding: 0;
102
- margin: -1px;
103
- overflow: hidden;
104
- clip: rect(0, 0, 0, 0);
105
- border: 0;
106
- }
107
-
108
- .col {
109
- width: 25%;
110
- height: 25px;
111
- }
112
-
113
- svg {
114
- height: 10px;
115
- width: 10px;
116
- display: block;
117
- margin: auto;
118
- }
119
-
120
- .status-text {
121
- font-size: 14px;
122
- height: 15px;
123
- color: #2c2c2c;
124
- line-height: 20px;
125
- margin: auto;
126
- display: block;
127
- text-align: center;
128
- }
129
- `;
130
- }
131
- }