@internetarchive/collection-browser 0.2.4 → 0.2.6-alpha2

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 (64) hide show
  1. package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.d.ts +0 -0
  2. package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.js +0 -0
  3. package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.js.map +1 -1
  4. package/dist/src/{tiles/grid/icons/views.d.ts → assets/img/icons/no-search-result.d.ts} +0 -0
  5. package/dist/src/assets/img/icons/no-search-result.js +5 -0
  6. package/dist/src/assets/img/icons/no-search-result.js.map +1 -0
  7. package/dist/src/assets/img/icons/no-search-term.d.ts +2 -0
  8. package/dist/src/assets/img/icons/no-search-term.js +5 -0
  9. package/dist/src/assets/img/icons/no-search-term.js.map +1 -0
  10. package/dist/src/{tiles/grid → assets/img}/icons/reviews.d.ts +0 -0
  11. package/dist/src/{tiles/grid → assets/img}/icons/reviews.js +0 -0
  12. package/dist/src/{tiles/grid → assets/img}/icons/reviews.js.map +1 -1
  13. package/dist/src/{tiles/grid → assets/img}/icons/upload.d.ts +0 -0
  14. package/dist/src/{tiles/grid → assets/img}/icons/upload.js +0 -0
  15. package/dist/src/{tiles/grid → assets/img}/icons/upload.js.map +1 -1
  16. package/dist/src/assets/img/icons/views.d.ts +1 -0
  17. package/dist/src/{tiles/grid → assets/img}/icons/views.js +1 -1
  18. package/dist/src/assets/img/icons/views.js.map +1 -0
  19. package/dist/src/collection-browser.d.ts +7 -0
  20. package/dist/src/collection-browser.js +95 -58
  21. package/dist/src/collection-browser.js.map +1 -1
  22. package/dist/src/empty-placeholder.d.ts +9 -0
  23. package/dist/src/empty-placeholder.js +72 -0
  24. package/dist/src/empty-placeholder.js.map +1 -0
  25. package/dist/src/tiles/grid/account-tile.d.ts +1 -0
  26. package/dist/src/tiles/grid/account-tile.js +45 -78
  27. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  28. package/dist/src/tiles/grid/item-tile.d.ts +1 -0
  29. package/dist/src/tiles/grid/item-tile.js +49 -122
  30. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  31. package/dist/src/tiles/grid/tile-stats.d.ts +10 -0
  32. package/dist/src/tiles/grid/tile-stats.js +134 -0
  33. package/dist/src/tiles/grid/tile-stats.js.map +1 -0
  34. package/dist/src/tiles/mediatype-icon.js +4 -0
  35. package/dist/src/tiles/mediatype-icon.js.map +1 -1
  36. package/dist/test/collection-browser.test.js +2 -0
  37. package/dist/test/collection-browser.test.js.map +1 -1
  38. package/dist/test/empty-placeholder.test.d.ts +1 -0
  39. package/dist/test/empty-placeholder.test.js +26 -0
  40. package/dist/test/empty-placeholder.test.js.map +1 -0
  41. package/dist/test/tile-stats.test.d.ts +1 -0
  42. package/dist/test/tile-stats.test.js +42 -0
  43. package/dist/test/tile-stats.test.js.map +1 -0
  44. package/package.json +1 -1
  45. package/src/{tiles/grid → assets/img}/icons/favorite-filled.ts +0 -0
  46. package/src/assets/img/icons/no-search-result.ts +5 -0
  47. package/src/assets/img/icons/no-search-term.ts +5 -0
  48. package/src/{tiles/grid → assets/img}/icons/reviews.ts +0 -0
  49. package/src/{tiles/grid → assets/img}/icons/upload.ts +0 -0
  50. package/src/{tiles/grid → assets/img}/icons/views.ts +1 -1
  51. package/src/collection-browser.ts +103 -61
  52. package/src/empty-placeholder.ts +70 -0
  53. package/src/tiles/grid/account-tile.ts +44 -77
  54. package/src/tiles/grid/item-tile.ts +50 -123
  55. package/src/tiles/grid/tile-stats.ts +132 -0
  56. package/src/tiles/mediatype-icon.ts +4 -0
  57. package/test/collection-browser.test.ts +3 -0
  58. package/test/empty-placeholder.test.ts +35 -0
  59. package/test/tile-stats.test.ts +57 -0
  60. package/dist/src/tiles/grid/icons/account.d.ts +0 -1
  61. package/dist/src/tiles/grid/icons/account.js +0 -12
  62. package/dist/src/tiles/grid/icons/account.js.map +0 -1
  63. package/dist/src/tiles/grid/icons/views.js.map +0 -1
  64. package/src/tiles/grid/icons/account.ts +0 -12
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { TileModel } from '../../models';
3
+ import './tile-stats';
3
4
  export declare class AccountTile extends LitElement {
4
5
  model?: TileModel;
5
6
  render(): import("lit-html").TemplateResult<1>;
@@ -1,52 +1,37 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, LitElement } from 'lit';
3
3
  import { customElement, property } from 'lit/decorators.js';
4
- import { accountIcon } from './icons/account';
5
- import { favoriteFilledIcon } from './icons/favorite-filled';
6
- import { reviewsIcon } from './icons/reviews';
7
- import { uploadIcon } from './icons/upload';
4
+ import './tile-stats';
8
5
  let AccountTile = class AccountTile extends LitElement {
9
6
  render() {
10
- var _a, _b, _c, _d, _e, _f, _g;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h;
11
8
  return html `
12
- <div class="outer-holder">
13
- <div class="inner-holder">
14
- <div id="header-holder">
15
- <div id="title-holder">
16
- <h1 class="truncated">${(_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier}</h1>
17
- </div>
18
- <div id="avatar-holder">
19
- <div
20
- id="avatar"
21
- style="background-image: url('https://archive.org/services/img/${(_b = this
22
- .model) === null || _b === void 0 ? void 0 : _b.identifier}')"
23
- ></div>
24
- </div>
25
- </div>
26
- <div id="year-holder">
27
- <div id="archivist-since">
28
- <h3>Archivist Since</h3>
29
- </div>
30
- <div id="year-holder">
31
- <h3>${(_d = (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateAdded) === null || _d === void 0 ? void 0 : _d.getFullYear()}</h3>
32
- </div>
33
- </div>
34
- <div id="status-holder">
35
- <div id="patron-icon">${accountIcon}</div>
36
- <div class="stat-icon">
37
- ${uploadIcon}
38
- <h3>${(_e = this.model) === null || _e === void 0 ? void 0 : _e.itemCount}</h3>
39
- </div>
40
- <div class="stat-icon">
41
- ${favoriteFilledIcon}
42
- <h3>${(_f = this.model) === null || _f === void 0 ? void 0 : _f.favCount}</h3>
43
- </div>
44
- <div class="stat-icon">
45
- ${reviewsIcon}
46
- <h3>${(_g = this.model) === null || _g === void 0 ? void 0 : _g.commentCount}</h3>
47
- </div>
9
+ <div class="account-tile-main">
10
+ <div id="title">
11
+ <h1 class="truncated">${(_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier}</h1>
12
+ </div>
13
+
14
+ <div class="account-info">
15
+ <div id="avatar-info">
16
+ <img
17
+ id="avatar"
18
+ alt="patron-avatar"
19
+ src="https://archive.org/services/img/${(_b = this.model) === null || _b === void 0 ? void 0 : _b.identifier}"
20
+ />
48
21
  </div>
22
+
23
+ <span id="archivist-since">
24
+ Archivist since ${(_d = (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateAdded) === null || _d === void 0 ? void 0 : _d.getFullYear()}
25
+ </span>
49
26
  </div>
27
+
28
+ <tile-stats
29
+ .mediatype=${(_e = this.model) === null || _e === void 0 ? void 0 : _e.mediatype}
30
+ .itemCount=${(_f = this.model) === null || _f === void 0 ? void 0 : _f.itemCount}
31
+ .favCount=${(_g = this.model) === null || _g === void 0 ? void 0 : _g.favCount}
32
+ .commentCount=${(_h = this.model) === null || _h === void 0 ? void 0 : _h.commentCount}
33
+ >
34
+ </tile-stats>
50
35
  </div>
51
36
  `;
52
37
  }
@@ -58,41 +43,45 @@ let AccountTile = class AccountTile extends LitElement {
58
43
  margin: 0;
59
44
  }
60
45
 
61
- h3 {
46
+ span {
62
47
  font-size: 14px;
63
- font-weight: bold;
64
48
  color: #2c2c2c;
65
49
  margin: 0px;
66
50
  }
67
51
 
68
- .outer-holder {
52
+ .account-tile-main {
69
53
  background-color: #fcf5e6;
70
54
  border: 1px #2c2c2c;
71
55
  border-radius: 4px;
72
56
  box-shadow: 1px 1px 2px 0px;
73
57
  height: 100%;
74
58
  display: flex;
59
+ flex-direction: column;
75
60
  text-align: center;
76
61
  width: 100%;
77
62
  }
78
63
 
79
- .inner-holder {
80
- padding: 5px;
81
- width: 100%;
82
- display: flex;
83
- flex-direction: column;
64
+ .account-info {
65
+ flex-grow: 1;
84
66
  }
85
67
 
86
- #header-holder {
87
- flex: 1;
68
+ #title {
69
+ padding: 5px 5px 0px 5px;
70
+ flex-shrink: 0;
71
+ height: 40px;
88
72
  }
89
73
 
90
- #title-holder {
91
- height: 40px;
92
- margin-bottom: 5px;
74
+ .account-tile-main:hover > #title > .truncated {
75
+ text-decoration: underline;
76
+ }
77
+
78
+ /** this is a workaround for Safari 15 where the hover effects are not working */
79
+ #title:hover > .truncated {
80
+ text-decoration: underline;
93
81
  }
94
82
 
95
- #avatar-holder {
83
+ #avatar-info {
84
+ margin-top: 5px;
96
85
  margin-bottom: 5px;
97
86
  display: flex;
98
87
  align-items: center;
@@ -107,27 +96,11 @@ let AccountTile = class AccountTile extends LitElement {
107
96
  box-shadow: 1px 1px 2px #888888;
108
97
  }
109
98
 
110
- #year-holder {
99
+ #archivist-since {
111
100
  margin-bottom: 5px;
112
101
  height: 40px;
113
102
  }
114
103
 
115
- #year-holder {
116
- margin: 0px;
117
- }
118
-
119
- #status-holder {
120
- height: 25px;
121
- display: flex;
122
- justify-content: space-evenly;
123
- line-height: initial;
124
- }
125
-
126
- #patron-icon {
127
- height: 25px;
128
- width: 25px;
129
- }
130
-
131
104
  .truncated {
132
105
  flex: 1;
133
106
  min-width: 0; /* Important for long words! */
@@ -137,15 +110,9 @@ let AccountTile = class AccountTile extends LitElement {
137
110
  display: -webkit-box;
138
111
  -webkit-box-orient: vertical;
139
112
  word-wrap: break-word;
140
- word-break: break-all;
141
113
  line-height: 2rem;
142
114
  text-align: center;
143
115
  }
144
-
145
- .stat-icon {
146
- height: 10px;
147
- width: 10px;
148
- }
149
116
  `;
150
117
  }
151
118
  };
@@ -1 +1 @@
1
- {"version":3,"file":"account-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/account-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,UAAU;IAGzC,MAAM;;QACJ,OAAO,IAAI,CAAA;;;;;sCAKuB,MAAA,IAAI,CAAC,KAAK,0CAAE,UAAU;;;;;iFAKqB,MAAA,IAAI;aAClE,KAAK,0CAAE,UAAU;;;;;;;;;oBAShB,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,0CAAE,WAAW,EAAE;;;;oCAIpB,WAAW;;gBAE/B,UAAU;oBACN,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;;;gBAGzB,kBAAkB;oBACd,MAAA,IAAI,CAAC,KAAK,0CAAE,QAAQ;;;gBAGxB,WAAW;oBACP,MAAA,IAAI,CAAC,KAAK,0CAAE,YAAY;;;;;KAKvC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+FT,CAAC;IACJ,CAAC;CACF,CAAA;AAhJ6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAmB;AADnC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAiJvB;SAjJY,WAAW","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { TileModel } from '../../models';\n\nimport { accountIcon } from './icons/account';\nimport { favoriteFilledIcon } from './icons/favorite-filled';\nimport { reviewsIcon } from './icons/reviews';\nimport { uploadIcon } from './icons/upload';\n\n@customElement('account-tile')\nexport class AccountTile extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n render() {\n return html`\n <div class=\"outer-holder\">\n <div class=\"inner-holder\">\n <div id=\"header-holder\">\n <div id=\"title-holder\">\n <h1 class=\"truncated\">${this.model?.identifier}</h1>\n </div>\n <div id=\"avatar-holder\">\n <div\n id=\"avatar\"\n style=\"background-image: url('https://archive.org/services/img/${this\n .model?.identifier}')\"\n ></div>\n </div>\n </div>\n <div id=\"year-holder\">\n <div id=\"archivist-since\">\n <h3>Archivist Since</h3>\n </div>\n <div id=\"year-holder\">\n <h3>${this.model?.dateAdded?.getFullYear()}</h3>\n </div>\n </div>\n <div id=\"status-holder\">\n <div id=\"patron-icon\">${accountIcon}</div>\n <div class=\"stat-icon\">\n ${uploadIcon}\n <h3>${this.model?.itemCount}</h3>\n </div>\n <div class=\"stat-icon\">\n ${favoriteFilledIcon}\n <h3>${this.model?.favCount}</h3>\n </div>\n <div class=\"stat-icon\">\n ${reviewsIcon}\n <h3>${this.model?.commentCount}</h3>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n static get styles() {\n return css`\n h1 {\n color: black;\n font-size: 16px;\n margin: 0;\n }\n\n h3 {\n font-size: 14px;\n font-weight: bold;\n color: #2c2c2c;\n margin: 0px;\n }\n\n .outer-holder {\n background-color: #fcf5e6;\n border: 1px #2c2c2c;\n border-radius: 4px;\n box-shadow: 1px 1px 2px 0px;\n height: 100%;\n display: flex;\n text-align: center;\n width: 100%;\n }\n\n .inner-holder {\n padding: 5px;\n width: 100%;\n display: flex;\n flex-direction: column;\n }\n\n #header-holder {\n flex: 1;\n }\n\n #title-holder {\n height: 40px;\n margin-bottom: 5px;\n }\n\n #avatar-holder {\n margin-bottom: 5px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n #avatar {\n background-position: 50% 50%;\n border-radius: 50%;\n width: 160px;\n height: 160px;\n box-shadow: 1px 1px 2px #888888;\n }\n\n #year-holder {\n margin-bottom: 5px;\n height: 40px;\n }\n\n #year-holder {\n margin: 0px;\n }\n\n #status-holder {\n height: 25px;\n display: flex;\n justify-content: space-evenly;\n line-height: initial;\n }\n\n #patron-icon {\n height: 25px;\n width: 25px;\n }\n\n .truncated {\n flex: 1;\n min-width: 0; /* Important for long words! */\n -webkit-line-clamp: 2;\n text-overflow: ellipsis;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n word-wrap: break-word;\n word-break: break-all;\n line-height: 2rem;\n text-align: center;\n }\n\n .stat-icon {\n height: 10px;\n width: 10px;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"account-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/account-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,cAAc,CAAC;AAGtB,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,UAAU;IAGzC,MAAM;;QACJ,OAAO,IAAI,CAAA;;;kCAGmB,MAAA,IAAI,CAAC,KAAK,0CAAE,UAAU;;;;;;;;sDAQF,MAAA,IAAI,CAAC,KAAK,0CAAE,UAAU;;;;;8BAK9C,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,0CAAE,WAAW,EAAE;;;;;uBAK3C,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;uBACrB,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;sBACtB,MAAA,IAAI,CAAC,KAAK,0CAAE,QAAQ;0BAChB,MAAA,IAAI,CAAC,KAAK,0CAAE,YAAY;;;;KAI7C,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6ET,CAAC;IACJ,CAAC;CACF,CAAA;AAlH6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAmB;AADnC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAmHvB;SAnHY,WAAW","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { TileModel } from '../../models';\n\nimport './tile-stats';\n\n@customElement('account-tile')\nexport class AccountTile extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n render() {\n return html`\n <div class=\"account-tile-main\">\n <div id=\"title\">\n <h1 class=\"truncated\">${this.model?.identifier}</h1>\n </div>\n\n <div class=\"account-info\">\n <div id=\"avatar-info\">\n <img\n id=\"avatar\"\n alt=\"patron-avatar\"\n src=\"https://archive.org/services/img/${this.model?.identifier}\"\n />\n </div>\n\n <span id=\"archivist-since\">\n Archivist since ${this.model?.dateAdded?.getFullYear()}\n </span>\n </div>\n\n <tile-stats\n .mediatype=${this.model?.mediatype}\n .itemCount=${this.model?.itemCount}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}\n >\n </tile-stats>\n </div>\n `;\n }\n\n static get styles() {\n return css`\n h1 {\n color: black;\n font-size: 16px;\n margin: 0;\n }\n\n span {\n font-size: 14px;\n color: #2c2c2c;\n margin: 0px;\n }\n\n .account-tile-main {\n background-color: #fcf5e6;\n border: 1px #2c2c2c;\n border-radius: 4px;\n box-shadow: 1px 1px 2px 0px;\n height: 100%;\n display: flex;\n flex-direction: column;\n text-align: center;\n width: 100%;\n }\n\n .account-info {\n flex-grow: 1;\n }\n\n #title {\n padding: 5px 5px 0px 5px;\n flex-shrink: 0;\n height: 40px;\n }\n\n .account-tile-main:hover > #title > .truncated {\n text-decoration: underline;\n }\n\n /** this is a workaround for Safari 15 where the hover effects are not working */\n #title:hover > .truncated {\n text-decoration: underline;\n }\n\n #avatar-info {\n margin-top: 5px;\n margin-bottom: 5px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n #avatar {\n background-position: 50% 50%;\n border-radius: 50%;\n width: 160px;\n height: 160px;\n box-shadow: 1px 1px 2px #888888;\n }\n\n #archivist-since {\n margin-bottom: 5px;\n height: 40px;\n }\n\n .truncated {\n flex: 1;\n min-width: 0; /* Important for long words! */\n -webkit-line-clamp: 2;\n text-overflow: ellipsis;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n word-wrap: break-word;\n line-height: 2rem;\n text-align: center;\n }\n `;\n }\n}\n"]}
@@ -2,6 +2,7 @@ import { CSSResultGroup, LitElement } from 'lit';
2
2
  import { TileModel } from '../../models';
3
3
  import '../mediatype-icon';
4
4
  import '../item-image';
5
+ import './tile-stats';
5
6
  export declare class ItemTile extends LitElement {
6
7
  model?: TileModel;
7
8
  baseImageUrl?: string;
@@ -2,189 +2,116 @@ import { __decorate } from "tslib";
2
2
  /* eslint-disable import/no-duplicates */
3
3
  import { css, html, LitElement, nothing } from 'lit';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
- import { formatCount } from '../../utils/format-count';
6
- import { favoriteFilledIcon } from './icons/favorite-filled';
7
- import { reviewsIcon } from './icons/reviews';
8
- import viewsIcon from './icons/views';
5
+ import { ifDefined } from 'lit/directives/if-defined.js';
9
6
  import '../mediatype-icon';
10
7
  import '../item-image';
8
+ import './tile-stats';
11
9
  let ItemTile = class ItemTile extends LitElement {
12
10
  render() {
13
- var _a, _b, _c, _d, _e, _f, _g;
14
- const itemTitle = ((_a = this.model) === null || _a === void 0 ? void 0 : _a.title) || nothing;
11
+ var _a, _b, _c, _d, _e, _f;
12
+ const itemTitle = (_a = this.model) === null || _a === void 0 ? void 0 : _a.title;
15
13
  const itemCreator = (_b = this.model) === null || _b === void 0 ? void 0 : _b.creator;
16
14
  return html `
17
- <div id="container">
18
- <div id="title-image-container">
19
- <h1 id="item-title" title=${itemTitle}>${itemTitle}</h1>
20
- <div id="item-image-container">
21
- <item-image .model=${this.model} .baseImageUrl=${this.baseImageUrl}>
15
+ <div class="container">
16
+ <div class="item-info">
17
+ <div id="title">
18
+ <h1 class="truncated" title=${ifDefined(itemTitle)}>${itemTitle}</h1>
19
+ </div>
20
+
21
+ <div id="image">
22
+ <item-image
23
+ .model=${this.model}
24
+ .baseImageUrl=${this.baseImageUrl}>
22
25
  </item-image>
23
26
  </div>
24
- <div class="item-creator">
25
- <div class="truncated">
26
- ${itemCreator
27
- ? html `<span>by&nbsp;${itemCreator}</span>`
28
- : nothing}
29
- </div>
27
+ <div class="created-by truncated">
28
+ ${itemCreator ? html `<span>by&nbsp;${itemCreator}</span>` : nothing}
30
29
  </div>
31
30
  </div>
32
31
 
33
- <div class="hr"></div>
34
-
35
- <div id="item-stats-container">
36
- <div id="stats-holder">
37
- <div class="col">
38
- <mediatype-icon
39
- .mediatype=${(_c = this.model) === null || _c === void 0 ? void 0 : _c.mediatype}
40
- .collection=${(_d = this.model) === null || _d === void 0 ? void 0 : _d.collections}
41
- style="--iconHeight:25px; --iconWidth:25px;"
42
- >
43
- </mediatype-icon>
44
- </div>
45
- <div class="col">
46
- ${viewsIcon}
47
- <p class="status-text">
48
- ${formatCount((_e = this.model) === null || _e === void 0 ? void 0 : _e.viewCount, 'short', 'short')}
49
- </p>
50
- </div>
51
- <div class="col">
52
- ${favoriteFilledIcon}
53
- <p class="status-text">
54
- ${formatCount((_f = this.model) === null || _f === void 0 ? void 0 : _f.itemCount, 'short', 'short')}
55
- </p>
56
- </div>
57
- <div class="col">
58
- ${reviewsIcon}
59
- <p class="status-text">
60
- ${formatCount((_g = this.model) === null || _g === void 0 ? void 0 : _g.favCount, 'short', 'short')}
61
- </p>
62
- </div>
63
- </div>
32
+ <tile-stats
33
+ .mediatype=${(_c = this.model) === null || _c === void 0 ? void 0 : _c.mediatype}
34
+ .viewCount=${(_d = this.model) === null || _d === void 0 ? void 0 : _d.viewCount}
35
+ .favCount=${(_e = this.model) === null || _e === void 0 ? void 0 : _e.favCount}
36
+ .commentCount=${(_f = this.model) === null || _f === void 0 ? void 0 : _f.commentCount}>
37
+ </tile-stats>
64
38
  </div>
65
39
  </div>
66
40
  `;
67
41
  }
68
42
  static get styles() {
69
- const cornerRadiusCss = css `var(--collectionTileCornerRadius, 4px)`;
70
43
  return css `
71
- #container {
44
+ .container {
72
45
  background-color: #ffffff;
73
- border-radius: ${cornerRadiusCss};
46
+ border-radius: var(--collectionTileCornerRadius, 4px);
74
47
  box-shadow: 1px 1px 2px 0px;
75
48
  display: flex;
76
49
  flex-direction: column;
77
50
  height: 100%;
78
- position: relative;
79
51
  }
80
52
 
81
- #title-image-container {
82
- display: flex;
83
- flex: 1;
84
- flex-direction: column;
85
- padding: 0.5rem 0.5rem 0 0.5rem;
53
+ .item-info {
54
+ padding: 5px 5px 0 5px;
55
+ flex-grow: 1;
86
56
  }
87
57
 
88
- #item-title {
89
- color: #2c2c2c;
90
- font-size: 1.6rem;
91
- text-align: center;
92
- margin-top: 0rem;
93
- margin-bottom: 0.5rem;
94
- overflow: hidden;
95
- text-overflow: ellipsis;
96
- display: -webkit-box;
97
- -webkit-line-clamp: 2;
98
- -webkit-box-orient: vertical;
99
- line-height: 2rem;
100
- height: 4rem;
58
+ #title {
59
+ flex-shrink: 0;
101
60
  }
102
61
 
103
- #item-image-container {
62
+ #image {
104
63
  display: flex;
105
64
  justify-content: center;
106
65
  flex: 1;
66
+ height: 16rem;
107
67
  }
108
68
 
109
69
  .hidden {
110
70
  display: none;
111
71
  }
112
72
 
113
- #container:hover > #title-image-container > .item-title {
73
+ .container:hover > .item-info > #title > .truncated {
114
74
  text-decoration: underline;
115
75
  }
116
76
 
117
77
  /** this is a workaround for Safari 15 where the hover effects are not working */
118
- #title-image-container:hover > #item-title {
78
+ #title:hover > .truncated {
119
79
  text-decoration: underline;
120
80
  }
121
81
 
122
- #container:hover > #item-title {
123
- background-color: #fcfcfc;
124
- }
125
-
126
- .item-creator {
82
+ .created-by {
127
83
  display: flex;
128
84
  justify-content: center;
129
85
  align-items: flex-end; /* Important to start text from bottom */
130
86
  height: 3rem;
131
87
  padding-top: 1rem;
88
+ margin-top: 5px;
132
89
  }
133
90
 
134
91
  .truncated {
135
92
  flex: 1;
136
- min-width: 0; /* Important for long words! */
137
- }
138
-
139
- .truncated span {
140
- font-size: 1.4rem;
141
93
  color: #2c2c2c;
142
- -webkit-line-clamp: 2;
94
+ min-width: 0; /* Important for long words! */
95
+ text-align: center;
96
+ line-height: 2rem;
143
97
  text-overflow: ellipsis;
144
98
  overflow: hidden;
145
- display: -webkit-box;
146
- -webkit-box-orient: vertical;
147
99
  word-wrap: break-word;
148
- line-height: 2rem;
149
- text-align: center;
150
- }
151
-
152
- .hr {
153
- border: 0.5px solid #ccc;
154
- }
155
-
156
- #item-stats-container {
157
- align-items: center;
158
- display: flex;
159
- height: 5.5rem;
160
- padding-left: 1rem;
161
- padding-right: 0.5rem;
162
- }
163
-
164
- #stats-holder {
165
- align-items: center;
166
- display: flex;
167
- flex: 1;
168
- justify-content: space-evenly;
169
- text-align: center;
170
- width: 100%;
171
- }
172
-
173
- svg {
174
- height: 10px;
175
- width: 10px;
100
+ -webkit-line-clamp: 2;
101
+ -webkit-box-orient: vertical;
176
102
  }
177
103
 
178
- .status-text {
179
- font-size: 14px;
180
- color: #2c2c2c;
181
- margin: auto;
182
- display: block;
183
- text-align: center;
104
+ .truncated span {
105
+ font-size: 1.4rem;
106
+ display: -webkit-box;
184
107
  }
185
108
 
186
- .col {
187
- width: 25%;
109
+ h1.truncated {
110
+ margin-top: 0rem;
111
+ margin-bottom: 0.5rem;
112
+ font-size: 1.6rem;
113
+ height: 4rem;
114
+ display: -webkit-box;
188
115
  }
189
116
  `;
190
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,SAAS,MAAM,eAAe,CAAC;AAEtC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AAGvB,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,UAAU;IAKtC,MAAM;;QACJ,MAAM,SAAS,GAAG,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,KAAK,KAAI,OAAO,CAAC;QAC/C,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,OAAO,CAAC;QACxC,OAAO,IAAI,CAAA;;;sCAGuB,SAAS,IAAI,SAAS;;iCAE3B,IAAI,CAAC,KAAK,kBAAkB,IAAI,CAAC,YAAY;;;;;gBAK9D,WAAW;YACX,CAAC,CAAC,IAAI,CAAA,iBAAiB,WAAW,SAAS;YAC3C,CAAC,CAAC,OAAO;;;;;;;;;;;6BAWI,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;8BACpB,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW;;;;;;gBAMrC,SAAS;;kBAEP,WAAW,CAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC;;;;gBAItD,kBAAkB;;kBAEhB,WAAW,CAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC;;;;gBAItD,WAAW;;kBAET,WAAW,CAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;;;;;;KAMhE,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,MAAM,eAAe,GAAG,GAAG,CAAA,wCAAwC,CAAC;QAEpE,OAAO,GAAG,CAAA;;;yBAGW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoHnC,CAAC;IACJ,CAAC;CACF,CAAA;AAxL6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAuB;AAHvC,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAyLpB;SAzLY,QAAQ","sourcesContent":["/* eslint-disable import/no-duplicates */\nimport { css, CSSResultGroup, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { TileModel } from '../../models';\nimport { formatCount } from '../../utils/format-count';\n\nimport { favoriteFilledIcon } from './icons/favorite-filled';\nimport { reviewsIcon } from './icons/reviews';\nimport viewsIcon from './icons/views';\n\nimport '../mediatype-icon';\nimport '../item-image';\n\n@customElement('item-tile')\nexport class ItemTile extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseImageUrl?: string;\n\n render() {\n const itemTitle = this.model?.title || nothing;\n const itemCreator = this.model?.creator;\n return html`\n <div id=\"container\">\n <div id=\"title-image-container\">\n <h1 id=\"item-title\" title=${itemTitle}>${itemTitle}</h1>\n <div id=\"item-image-container\">\n <item-image .model=${this.model} .baseImageUrl=${this.baseImageUrl}>\n </item-image>\n </div>\n <div class=\"item-creator\">\n <div class=\"truncated\">\n ${itemCreator\n ? html`<span>by&nbsp;${itemCreator}</span>`\n : nothing}\n </div>\n </div>\n </div>\n\n <div class=\"hr\"></div>\n\n <div id=\"item-stats-container\">\n <div id=\"stats-holder\">\n <div class=\"col\">\n <mediatype-icon\n .mediatype=${this.model?.mediatype}\n .collection=${this.model?.collections}\n style=\"--iconHeight:25px; --iconWidth:25px;\"\n >\n </mediatype-icon>\n </div>\n <div class=\"col\">\n ${viewsIcon}\n <p class=\"status-text\">\n ${formatCount(this.model?.viewCount, 'short', 'short')}\n </p>\n </div>\n <div class=\"col\">\n ${favoriteFilledIcon}\n <p class=\"status-text\">\n ${formatCount(this.model?.itemCount, 'short', 'short')}\n </p>\n </div>\n <div class=\"col\">\n ${reviewsIcon}\n <p class=\"status-text\">\n ${formatCount(this.model?.favCount, 'short', 'short')}\n </p>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n const cornerRadiusCss = css`var(--collectionTileCornerRadius, 4px)`;\n\n return css`\n #container {\n background-color: #ffffff;\n border-radius: ${cornerRadiusCss};\n box-shadow: 1px 1px 2px 0px;\n display: flex;\n flex-direction: column;\n height: 100%;\n position: relative;\n }\n\n #title-image-container {\n display: flex;\n flex: 1;\n flex-direction: column;\n padding: 0.5rem 0.5rem 0 0.5rem;\n }\n\n #item-title {\n color: #2c2c2c;\n font-size: 1.6rem;\n text-align: center;\n margin-top: 0rem;\n margin-bottom: 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n line-height: 2rem;\n height: 4rem;\n }\n\n #item-image-container {\n display: flex;\n justify-content: center;\n flex: 1;\n }\n\n .hidden {\n display: none;\n }\n\n #container:hover > #title-image-container > .item-title {\n text-decoration: underline;\n }\n\n /** this is a workaround for Safari 15 where the hover effects are not working */\n #title-image-container:hover > #item-title {\n text-decoration: underline;\n }\n\n #container:hover > #item-title {\n background-color: #fcfcfc;\n }\n\n .item-creator {\n display: flex;\n justify-content: center;\n align-items: flex-end; /* Important to start text from bottom */\n height: 3rem;\n padding-top: 1rem;\n }\n\n .truncated {\n flex: 1;\n min-width: 0; /* Important for long words! */\n }\n\n .truncated span {\n font-size: 1.4rem;\n color: #2c2c2c;\n -webkit-line-clamp: 2;\n text-overflow: ellipsis;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n word-wrap: break-word;\n line-height: 2rem;\n text-align: center;\n }\n\n .hr {\n border: 0.5px solid #ccc;\n }\n\n #item-stats-container {\n align-items: center;\n display: flex;\n height: 5.5rem;\n padding-left: 1rem;\n padding-right: 0.5rem;\n }\n\n #stats-holder {\n align-items: center;\n display: flex;\n flex: 1;\n justify-content: space-evenly;\n text-align: center;\n width: 100%;\n }\n\n svg {\n height: 10px;\n width: 10px;\n }\n\n .status-text {\n font-size: 14px;\n color: #2c2c2c;\n margin: auto;\n display: block;\n text-align: center;\n }\n\n .col {\n width: 25%;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAIzD,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AAGtB,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,UAAU;IAKtC,MAAM;;QACJ,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,KAAK,CAAC;QACpC,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,OAAO,CAAC;QACxC,OAAO,IAAI,CAAA;;;;0CAI2B,SAAS,CACrC,SAAS,CACV,IAAI,SAAS;;;;;uBAKH,IAAI,CAAC,KAAK;8BACH,IAAI,CAAC,YAAY;;;;cAIjC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,iBAAiB,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO;;;;;uBAKxD,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;uBACrB,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;sBACtB,MAAA,IAAI,CAAC,KAAK,0CAAE,QAAQ;0BAChB,MAAA,IAAI,CAAC,KAAK,0CAAE,YAAY;;;;KAI7C,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyET,CAAC;IACJ,CAAC;CACF,CAAA;AAlH6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAuB;AAHvC,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAmHpB;SAnHY,QAAQ","sourcesContent":["/* eslint-disable import/no-duplicates */\nimport { css, CSSResultGroup, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { TileModel } from '../../models';\n\nimport '../mediatype-icon';\nimport '../item-image';\nimport './tile-stats';\n\n@customElement('item-tile')\nexport class ItemTile extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseImageUrl?: string;\n\n render() {\n const itemTitle = this.model?.title;\n const itemCreator = this.model?.creator;\n return html`\n <div class=\"container\">\n <div class=\"item-info\">\n <div id=\"title\">\n <h1 class=\"truncated\" title=${ifDefined(\n itemTitle\n )}>${itemTitle}</h1>\n </div>\n\n <div id=\"image\">\n <item-image\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}>\n </item-image>\n </div>\n <div class=\"created-by truncated\">\n ${itemCreator ? html`<span>by&nbsp;${itemCreator}</span>` : nothing}\n </div>\n </div>\n\n <tile-stats \n .mediatype=${this.model?.mediatype}\n .viewCount=${this.model?.viewCount}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}>\n </tile-stats>\n </div>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return css`\n .container {\n background-color: #ffffff;\n border-radius: var(--collectionTileCornerRadius, 4px);\n box-shadow: 1px 1px 2px 0px;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .item-info {\n padding: 5px 5px 0 5px;\n flex-grow: 1;\n }\n\n #title {\n flex-shrink: 0;\n }\n\n #image {\n display: flex;\n justify-content: center;\n flex: 1;\n height: 16rem;\n }\n\n .hidden {\n display: none;\n }\n\n .container:hover > .item-info > #title > .truncated {\n text-decoration: underline;\n }\n\n /** this is a workaround for Safari 15 where the hover effects are not working */\n #title:hover > .truncated {\n text-decoration: underline;\n }\n\n .created-by {\n display: flex;\n justify-content: center;\n align-items: flex-end; /* Important to start text from bottom */\n height: 3rem;\n padding-top: 1rem;\n margin-top: 5px;\n }\n\n .truncated {\n flex: 1;\n color: #2c2c2c;\n min-width: 0; /* Important for long words! */\n text-align: center;\n line-height: 2rem;\n text-overflow: ellipsis;\n overflow: hidden;\n word-wrap: break-word;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .truncated span {\n font-size: 1.4rem;\n display: -webkit-box;\n }\n\n h1.truncated {\n margin-top: 0rem;\n margin-bottom: 0.5rem;\n font-size: 1.6rem;\n height: 4rem;\n display: -webkit-box;\n }\n `;\n }\n}\n"]}
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,134 @@
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 Stats' : 'Item Stats'}
15
+ </p>
16
+ <ul id="stats-row">
17
+ <li class="col">
18
+ <p class="sr-only">Mediatype:</p>
19
+ <mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>
20
+ </li>
21
+ <li class="col">
22
+ ${this.mediatype === 'account' ? uploadIcon : viewsIcon}
23
+ <p class="status-text">
24
+ <span class="sr-only">
25
+ ${this.mediatype === 'account' ? 'Uploads:' : 'Views:'}
26
+ </span>
27
+ ${formatCount(this.mediatype === 'account' ? this.itemCount : this.viewCount, 'short', 'short')}
28
+ </p>
29
+ </li>
30
+ <li class="col">
31
+ ${favoriteFilledIcon}
32
+ <p class="status-text">
33
+ <span class="sr-only">Favorites:</span>
34
+ ${formatCount(this.favCount, 'short', 'short')}
35
+ </p>
36
+ </li>
37
+ <li class="col">
38
+ ${reviewsIcon}
39
+ <p class="status-text">
40
+ <span class="sr-only">Reviews:</span>
41
+ ${formatCount(this.commentCount, 'short', 'short')}
42
+ </p>
43
+ </li>
44
+ </ul>
45
+ </div>
46
+ `;
47
+ }
48
+ static get styles() {
49
+ return css `
50
+ mediatype-icon {
51
+ --iconHeight: 25px;
52
+ --iconWidth: 25px;
53
+ }
54
+
55
+ ul {
56
+ all: unset; // unset all property values
57
+ list-style-type: none; // remove default list-style
58
+ }
59
+
60
+ li {
61
+ list-style-type: none; // remove default list-style
62
+ }
63
+
64
+ .item-stats {
65
+ height: 35px;
66
+ }
67
+
68
+ #stats-row {
69
+ border-top: 1px solid #bbb;
70
+ align-items: center;
71
+ display: flex;
72
+ flex: 1;
73
+ justify-content: space-evenly;
74
+ text-align: center;
75
+ width: 100%;
76
+ padding-top: 5px;
77
+ padding-bottom: 5px;
78
+ }
79
+
80
+ .sr-only {
81
+ position: absolute;
82
+ width: 1px;
83
+ height: 1px;
84
+ padding: 0;
85
+ margin: -1px;
86
+ overflow: hidden;
87
+ clip: rect(0, 0, 0, 0);
88
+ border: 0;
89
+ }
90
+
91
+ .col {
92
+ width: 25%;
93
+ height: 25px;
94
+ }
95
+
96
+ svg {
97
+ height: 10px;
98
+ width: 10px;
99
+ display: block;
100
+ margin: auto;
101
+ }
102
+
103
+ .status-text {
104
+ font-size: 14px;
105
+ height: 15px;
106
+ color: #2c2c2c;
107
+ line-height: 20px;
108
+ margin: auto;
109
+ display: block;
110
+ text-align: center;
111
+ }
112
+ `;
113
+ }
114
+ };
115
+ __decorate([
116
+ property({ type: String })
117
+ ], TileStats.prototype, "mediatype", void 0);
118
+ __decorate([
119
+ property({ type: Number })
120
+ ], TileStats.prototype, "itemCount", void 0);
121
+ __decorate([
122
+ property({ type: Number })
123
+ ], TileStats.prototype, "viewCount", void 0);
124
+ __decorate([
125
+ property({ type: Number })
126
+ ], TileStats.prototype, "favCount", void 0);
127
+ __decorate([
128
+ property({ type: Number })
129
+ ], TileStats.prototype, "commentCount", void 0);
130
+ TileStats = __decorate([
131
+ customElement('tile-stats')
132
+ ], TileStats);
133
+ export { TileStats };
134
+ //# sourceMappingURL=tile-stats.js.map
@@ -0,0 +1 @@
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,eAAe,CAAC,CAAC,CAAC,YAAY;;;;;yCAKhC,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,UAAU,CAAC,CAAC,CAAC,QAAQ;;gBAEtD,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;AAvH6B;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,CAwHrB;SAxHY,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 Stats' : 'Item Stats'}\n </p>\n <ul id=\"stats-row\">\n <li class=\"col\">\n <p class=\"sr-only\">Mediatype:</p>\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:'}\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:</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:</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"]}