@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.
- package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.d.ts +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.js +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.js.map +1 -1
- package/dist/src/{tiles/grid/icons/views.d.ts → assets/img/icons/no-search-result.d.ts} +0 -0
- package/dist/src/assets/img/icons/no-search-result.js +5 -0
- package/dist/src/assets/img/icons/no-search-result.js.map +1 -0
- package/dist/src/assets/img/icons/no-search-term.d.ts +2 -0
- package/dist/src/assets/img/icons/no-search-term.js +5 -0
- package/dist/src/assets/img/icons/no-search-term.js.map +1 -0
- package/dist/src/{tiles/grid → assets/img}/icons/reviews.d.ts +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/reviews.js +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/reviews.js.map +1 -1
- package/dist/src/{tiles/grid → assets/img}/icons/upload.d.ts +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/upload.js +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/upload.js.map +1 -1
- package/dist/src/assets/img/icons/views.d.ts +1 -0
- package/dist/src/{tiles/grid → assets/img}/icons/views.js +1 -1
- package/dist/src/assets/img/icons/views.js.map +1 -0
- package/dist/src/collection-browser.d.ts +7 -0
- package/dist/src/collection-browser.js +95 -58
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +9 -0
- package/dist/src/empty-placeholder.js +72 -0
- package/dist/src/empty-placeholder.js.map +1 -0
- package/dist/src/tiles/grid/account-tile.d.ts +1 -0
- package/dist/src/tiles/grid/account-tile.js +45 -78
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +1 -0
- package/dist/src/tiles/grid/item-tile.js +49 -122
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.d.ts +10 -0
- package/dist/src/tiles/grid/tile-stats.js +134 -0
- package/dist/src/tiles/grid/tile-stats.js.map +1 -0
- package/dist/src/tiles/mediatype-icon.js +4 -0
- package/dist/src/tiles/mediatype-icon.js.map +1 -1
- package/dist/test/collection-browser.test.js +2 -0
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.d.ts +1 -0
- package/dist/test/empty-placeholder.test.js +26 -0
- package/dist/test/empty-placeholder.test.js.map +1 -0
- package/dist/test/tile-stats.test.d.ts +1 -0
- package/dist/test/tile-stats.test.js +42 -0
- package/dist/test/tile-stats.test.js.map +1 -0
- package/package.json +1 -1
- package/src/{tiles/grid → assets/img}/icons/favorite-filled.ts +0 -0
- package/src/assets/img/icons/no-search-result.ts +5 -0
- package/src/assets/img/icons/no-search-term.ts +5 -0
- package/src/{tiles/grid → assets/img}/icons/reviews.ts +0 -0
- package/src/{tiles/grid → assets/img}/icons/upload.ts +0 -0
- package/src/{tiles/grid → assets/img}/icons/views.ts +1 -1
- package/src/collection-browser.ts +103 -61
- package/src/empty-placeholder.ts +70 -0
- package/src/tiles/grid/account-tile.ts +44 -77
- package/src/tiles/grid/item-tile.ts +50 -123
- package/src/tiles/grid/tile-stats.ts +132 -0
- package/src/tiles/mediatype-icon.ts +4 -0
- package/test/collection-browser.test.ts +3 -0
- package/test/empty-placeholder.test.ts +35 -0
- package/test/tile-stats.test.ts +57 -0
- package/dist/src/tiles/grid/icons/account.d.ts +0 -1
- package/dist/src/tiles/grid/icons/account.js +0 -12
- package/dist/src/tiles/grid/icons/account.js.map +0 -1
- package/dist/src/tiles/grid/icons/views.js.map +0 -1
- package/src/tiles/grid/icons/account.ts +0 -12
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { css, html, LitElement, CSSResultGroup } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import noSearchTermIcon from './assets/img/icons/no-search-term';
|
|
5
|
+
import noSearchResultIcon from './assets/img/icons/no-search-result';
|
|
6
|
+
|
|
7
|
+
@customElement('empty-placeholder')
|
|
8
|
+
export class EmptyPlaceholder extends LitElement {
|
|
9
|
+
@property({ type: String }) placeholderType?: string;
|
|
10
|
+
|
|
11
|
+
@property({ type: Boolean }) mobileView?: false;
|
|
12
|
+
|
|
13
|
+
render() {
|
|
14
|
+
return html`
|
|
15
|
+
${this.placeholderType === 'no-search-term'
|
|
16
|
+
? this.noSearchTermTemplate
|
|
17
|
+
: this.noSearchResultTemplate}
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private get noSearchResultTemplate() {
|
|
22
|
+
return html`<div
|
|
23
|
+
class="placeholder no-result ${this.mobileView ? 'mobile' : 'desktop'}"
|
|
24
|
+
>
|
|
25
|
+
<h2 class="title">
|
|
26
|
+
Your search did not match any items in the Archive. Try different
|
|
27
|
+
keywords or a more general search.
|
|
28
|
+
</h2>
|
|
29
|
+
<div>${noSearchResultIcon}</div>
|
|
30
|
+
</div>`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private get noSearchTermTemplate() {
|
|
34
|
+
return html`<div
|
|
35
|
+
class="placeholder no-term ${this.mobileView ? 'mobile' : 'desktop'}"
|
|
36
|
+
>
|
|
37
|
+
<h2 class="title">
|
|
38
|
+
To being searching, enter a search term in the box above and hit "Go".
|
|
39
|
+
</h2>
|
|
40
|
+
<div>${noSearchTermIcon}</div>
|
|
41
|
+
</div>`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static get styles(): CSSResultGroup {
|
|
45
|
+
return css`
|
|
46
|
+
:host {
|
|
47
|
+
text-align: center;
|
|
48
|
+
width: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.placeholder {
|
|
52
|
+
display: block;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.desktop svg {
|
|
56
|
+
max-height: 40rem;
|
|
57
|
+
}
|
|
58
|
+
.desktop .title {
|
|
59
|
+
margin: 4rem 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.mobile svg {
|
|
63
|
+
max-height: 20rem;
|
|
64
|
+
}
|
|
65
|
+
.mobile .title {
|
|
66
|
+
margin: 2rem 0.5;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -2,10 +2,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
import { TileModel } from '../../models';
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { favoriteFilledIcon } from './icons/favorite-filled';
|
|
7
|
-
import { reviewsIcon } from './icons/reviews';
|
|
8
|
-
import { uploadIcon } from './icons/upload';
|
|
5
|
+
import './tile-stats';
|
|
9
6
|
|
|
10
7
|
@customElement('account-tile')
|
|
11
8
|
export class AccountTile extends LitElement {
|
|
@@ -13,44 +10,32 @@ export class AccountTile extends LitElement {
|
|
|
13
10
|
|
|
14
11
|
render() {
|
|
15
12
|
return html`
|
|
16
|
-
<div class="
|
|
17
|
-
<div
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
<div id="year-holder">
|
|
31
|
-
<div id="archivist-since">
|
|
32
|
-
<h3>Archivist Since</h3>
|
|
33
|
-
</div>
|
|
34
|
-
<div id="year-holder">
|
|
35
|
-
<h3>${this.model?.dateAdded?.getFullYear()}</h3>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
<div id="status-holder">
|
|
39
|
-
<div id="patron-icon">${accountIcon}</div>
|
|
40
|
-
<div class="stat-icon">
|
|
41
|
-
${uploadIcon}
|
|
42
|
-
<h3>${this.model?.itemCount}</h3>
|
|
43
|
-
</div>
|
|
44
|
-
<div class="stat-icon">
|
|
45
|
-
${favoriteFilledIcon}
|
|
46
|
-
<h3>${this.model?.favCount}</h3>
|
|
47
|
-
</div>
|
|
48
|
-
<div class="stat-icon">
|
|
49
|
-
${reviewsIcon}
|
|
50
|
-
<h3>${this.model?.commentCount}</h3>
|
|
51
|
-
</div>
|
|
13
|
+
<div class="account-tile-main">
|
|
14
|
+
<div id="title">
|
|
15
|
+
<h1 class="truncated">${this.model?.identifier}</h1>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="account-info">
|
|
19
|
+
<div id="avatar-info">
|
|
20
|
+
<img
|
|
21
|
+
id="avatar"
|
|
22
|
+
alt="patron-avatar"
|
|
23
|
+
src="https://archive.org/services/img/${this.model?.identifier}"
|
|
24
|
+
/>
|
|
52
25
|
</div>
|
|
26
|
+
|
|
27
|
+
<span id="archivist-since">
|
|
28
|
+
Archivist since ${this.model?.dateAdded?.getFullYear()}
|
|
29
|
+
</span>
|
|
53
30
|
</div>
|
|
31
|
+
|
|
32
|
+
<tile-stats
|
|
33
|
+
.mediatype=${this.model?.mediatype}
|
|
34
|
+
.itemCount=${this.model?.itemCount}
|
|
35
|
+
.favCount=${this.model?.favCount}
|
|
36
|
+
.commentCount=${this.model?.commentCount}
|
|
37
|
+
>
|
|
38
|
+
</tile-stats>
|
|
54
39
|
</div>
|
|
55
40
|
`;
|
|
56
41
|
}
|
|
@@ -63,41 +48,45 @@ export class AccountTile extends LitElement {
|
|
|
63
48
|
margin: 0;
|
|
64
49
|
}
|
|
65
50
|
|
|
66
|
-
|
|
51
|
+
span {
|
|
67
52
|
font-size: 14px;
|
|
68
|
-
font-weight: bold;
|
|
69
53
|
color: #2c2c2c;
|
|
70
54
|
margin: 0px;
|
|
71
55
|
}
|
|
72
56
|
|
|
73
|
-
.
|
|
57
|
+
.account-tile-main {
|
|
74
58
|
background-color: #fcf5e6;
|
|
75
59
|
border: 1px #2c2c2c;
|
|
76
60
|
border-radius: 4px;
|
|
77
61
|
box-shadow: 1px 1px 2px 0px;
|
|
78
62
|
height: 100%;
|
|
79
63
|
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
80
65
|
text-align: center;
|
|
81
66
|
width: 100%;
|
|
82
67
|
}
|
|
83
68
|
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
width: 100%;
|
|
87
|
-
display: flex;
|
|
88
|
-
flex-direction: column;
|
|
69
|
+
.account-info {
|
|
70
|
+
flex-grow: 1;
|
|
89
71
|
}
|
|
90
72
|
|
|
91
|
-
#
|
|
92
|
-
|
|
73
|
+
#title {
|
|
74
|
+
padding: 5px 5px 0px 5px;
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
height: 40px;
|
|
93
77
|
}
|
|
94
78
|
|
|
95
|
-
#title
|
|
96
|
-
|
|
97
|
-
|
|
79
|
+
.account-tile-main:hover > #title > .truncated {
|
|
80
|
+
text-decoration: underline;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** this is a workaround for Safari 15 where the hover effects are not working */
|
|
84
|
+
#title:hover > .truncated {
|
|
85
|
+
text-decoration: underline;
|
|
98
86
|
}
|
|
99
87
|
|
|
100
|
-
#avatar-
|
|
88
|
+
#avatar-info {
|
|
89
|
+
margin-top: 5px;
|
|
101
90
|
margin-bottom: 5px;
|
|
102
91
|
display: flex;
|
|
103
92
|
align-items: center;
|
|
@@ -112,27 +101,11 @@ export class AccountTile extends LitElement {
|
|
|
112
101
|
box-shadow: 1px 1px 2px #888888;
|
|
113
102
|
}
|
|
114
103
|
|
|
115
|
-
#
|
|
104
|
+
#archivist-since {
|
|
116
105
|
margin-bottom: 5px;
|
|
117
106
|
height: 40px;
|
|
118
107
|
}
|
|
119
108
|
|
|
120
|
-
#year-holder {
|
|
121
|
-
margin: 0px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
#status-holder {
|
|
125
|
-
height: 25px;
|
|
126
|
-
display: flex;
|
|
127
|
-
justify-content: space-evenly;
|
|
128
|
-
line-height: initial;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
#patron-icon {
|
|
132
|
-
height: 25px;
|
|
133
|
-
width: 25px;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
109
|
.truncated {
|
|
137
110
|
flex: 1;
|
|
138
111
|
min-width: 0; /* Important for long words! */
|
|
@@ -142,15 +115,9 @@ export class AccountTile extends LitElement {
|
|
|
142
115
|
display: -webkit-box;
|
|
143
116
|
-webkit-box-orient: vertical;
|
|
144
117
|
word-wrap: break-word;
|
|
145
|
-
word-break: break-all;
|
|
146
118
|
line-height: 2rem;
|
|
147
119
|
text-align: center;
|
|
148
120
|
}
|
|
149
|
-
|
|
150
|
-
.stat-icon {
|
|
151
|
-
height: 10px;
|
|
152
|
-
width: 10px;
|
|
153
|
-
}
|
|
154
121
|
`;
|
|
155
122
|
}
|
|
156
123
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
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';
|
|
4
5
|
|
|
5
6
|
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';
|
|
11
7
|
|
|
12
8
|
import '../mediatype-icon';
|
|
13
9
|
import '../item-image';
|
|
10
|
+
import './tile-stats';
|
|
14
11
|
|
|
15
12
|
@customElement('item-tile')
|
|
16
13
|
export class ItemTile extends LitElement {
|
|
@@ -19,182 +16,112 @@ export class ItemTile extends LitElement {
|
|
|
19
16
|
@property({ type: String }) baseImageUrl?: string;
|
|
20
17
|
|
|
21
18
|
render() {
|
|
22
|
-
const itemTitle = this.model?.title
|
|
19
|
+
const itemTitle = this.model?.title;
|
|
23
20
|
const itemCreator = this.model?.creator;
|
|
24
21
|
return html`
|
|
25
|
-
<div
|
|
26
|
-
<div
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
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}>
|
|
30
34
|
</item-image>
|
|
31
35
|
</div>
|
|
32
|
-
<div class="
|
|
33
|
-
|
|
34
|
-
${itemCreator
|
|
35
|
-
? html`<span>by ${itemCreator}</span>`
|
|
36
|
-
: nothing}
|
|
37
|
-
</div>
|
|
36
|
+
<div class="created-by truncated">
|
|
37
|
+
${itemCreator ? html`<span>by ${itemCreator}</span>` : nothing}
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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>
|
|
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>
|
|
72
47
|
</div>
|
|
73
48
|
</div>
|
|
74
49
|
`;
|
|
75
50
|
}
|
|
76
51
|
|
|
77
52
|
static get styles(): CSSResultGroup {
|
|
78
|
-
const cornerRadiusCss = css`var(--collectionTileCornerRadius, 4px)`;
|
|
79
|
-
|
|
80
53
|
return css`
|
|
81
|
-
|
|
54
|
+
.container {
|
|
82
55
|
background-color: #ffffff;
|
|
83
|
-
border-radius:
|
|
56
|
+
border-radius: var(--collectionTileCornerRadius, 4px);
|
|
84
57
|
box-shadow: 1px 1px 2px 0px;
|
|
85
58
|
display: flex;
|
|
86
59
|
flex-direction: column;
|
|
87
60
|
height: 100%;
|
|
88
|
-
position: relative;
|
|
89
61
|
}
|
|
90
62
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
flex: 1;
|
|
94
|
-
flex-direction: column;
|
|
95
|
-
padding: 0.5rem 0.5rem 0 0.5rem;
|
|
63
|
+
.item-info {
|
|
64
|
+
padding: 5px 5px 0 5px;
|
|
65
|
+
flex-grow: 1;
|
|
96
66
|
}
|
|
97
67
|
|
|
98
|
-
#
|
|
99
|
-
|
|
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;
|
|
68
|
+
#title {
|
|
69
|
+
flex-shrink: 0;
|
|
111
70
|
}
|
|
112
71
|
|
|
113
|
-
#
|
|
72
|
+
#image {
|
|
114
73
|
display: flex;
|
|
115
74
|
justify-content: center;
|
|
116
75
|
flex: 1;
|
|
76
|
+
height: 16rem;
|
|
117
77
|
}
|
|
118
78
|
|
|
119
79
|
.hidden {
|
|
120
80
|
display: none;
|
|
121
81
|
}
|
|
122
82
|
|
|
123
|
-
|
|
83
|
+
.container:hover > .item-info > #title > .truncated {
|
|
124
84
|
text-decoration: underline;
|
|
125
85
|
}
|
|
126
86
|
|
|
127
87
|
/** this is a workaround for Safari 15 where the hover effects are not working */
|
|
128
|
-
#title
|
|
88
|
+
#title:hover > .truncated {
|
|
129
89
|
text-decoration: underline;
|
|
130
90
|
}
|
|
131
91
|
|
|
132
|
-
|
|
133
|
-
background-color: #fcfcfc;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.item-creator {
|
|
92
|
+
.created-by {
|
|
137
93
|
display: flex;
|
|
138
94
|
justify-content: center;
|
|
139
95
|
align-items: flex-end; /* Important to start text from bottom */
|
|
140
96
|
height: 3rem;
|
|
141
97
|
padding-top: 1rem;
|
|
98
|
+
margin-top: 5px;
|
|
142
99
|
}
|
|
143
100
|
|
|
144
101
|
.truncated {
|
|
145
102
|
flex: 1;
|
|
146
|
-
min-width: 0; /* Important for long words! */
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.truncated span {
|
|
150
|
-
font-size: 1.4rem;
|
|
151
103
|
color: #2c2c2c;
|
|
152
|
-
-
|
|
104
|
+
min-width: 0; /* Important for long words! */
|
|
105
|
+
text-align: center;
|
|
106
|
+
line-height: 2rem;
|
|
153
107
|
text-overflow: ellipsis;
|
|
154
108
|
overflow: hidden;
|
|
155
|
-
display: -webkit-box;
|
|
156
|
-
-webkit-box-orient: vertical;
|
|
157
109
|
word-wrap: break-word;
|
|
158
|
-
line-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
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;
|
|
110
|
+
-webkit-line-clamp: 2;
|
|
111
|
+
-webkit-box-orient: vertical;
|
|
186
112
|
}
|
|
187
113
|
|
|
188
|
-
.
|
|
189
|
-
font-size:
|
|
190
|
-
|
|
191
|
-
margin: auto;
|
|
192
|
-
display: block;
|
|
193
|
-
text-align: center;
|
|
114
|
+
.truncated span {
|
|
115
|
+
font-size: 1.4rem;
|
|
116
|
+
display: -webkit-box;
|
|
194
117
|
}
|
|
195
118
|
|
|
196
|
-
.
|
|
197
|
-
|
|
119
|
+
h1.truncated {
|
|
120
|
+
margin-top: 0rem;
|
|
121
|
+
margin-bottom: 0.5rem;
|
|
122
|
+
font-size: 1.6rem;
|
|
123
|
+
height: 4rem;
|
|
124
|
+
display: -webkit-box;
|
|
198
125
|
}
|
|
199
126
|
`;
|
|
200
127
|
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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 Stats' : 'Item Stats'}
|
|
28
|
+
</p>
|
|
29
|
+
<ul id="stats-row">
|
|
30
|
+
<li class="col">
|
|
31
|
+
<p class="sr-only">Mediatype:</p>
|
|
32
|
+
<mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>
|
|
33
|
+
</li>
|
|
34
|
+
<li class="col">
|
|
35
|
+
${this.mediatype === 'account' ? uploadIcon : viewsIcon}
|
|
36
|
+
<p class="status-text">
|
|
37
|
+
<span class="sr-only">
|
|
38
|
+
${this.mediatype === 'account' ? 'Uploads:' : 'Views:'}
|
|
39
|
+
</span>
|
|
40
|
+
${formatCount(
|
|
41
|
+
this.mediatype === 'account' ? this.itemCount : this.viewCount,
|
|
42
|
+
'short',
|
|
43
|
+
'short'
|
|
44
|
+
)}
|
|
45
|
+
</p>
|
|
46
|
+
</li>
|
|
47
|
+
<li class="col">
|
|
48
|
+
${favoriteFilledIcon}
|
|
49
|
+
<p class="status-text">
|
|
50
|
+
<span class="sr-only">Favorites:</span>
|
|
51
|
+
${formatCount(this.favCount, 'short', 'short')}
|
|
52
|
+
</p>
|
|
53
|
+
</li>
|
|
54
|
+
<li class="col">
|
|
55
|
+
${reviewsIcon}
|
|
56
|
+
<p class="status-text">
|
|
57
|
+
<span class="sr-only">Reviews:</span>
|
|
58
|
+
${formatCount(this.commentCount, 'short', 'short')}
|
|
59
|
+
</p>
|
|
60
|
+
</li>
|
|
61
|
+
</ul>
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static get styles(): CSSResultGroup {
|
|
67
|
+
return css`
|
|
68
|
+
mediatype-icon {
|
|
69
|
+
--iconHeight: 25px;
|
|
70
|
+
--iconWidth: 25px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
ul {
|
|
74
|
+
all: unset; // unset all property values
|
|
75
|
+
list-style-type: none; // remove default list-style
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
li {
|
|
79
|
+
list-style-type: none; // remove default list-style
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.item-stats {
|
|
83
|
+
height: 35px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#stats-row {
|
|
87
|
+
border-top: 1px solid #bbb;
|
|
88
|
+
align-items: center;
|
|
89
|
+
display: flex;
|
|
90
|
+
flex: 1;
|
|
91
|
+
justify-content: space-evenly;
|
|
92
|
+
text-align: center;
|
|
93
|
+
width: 100%;
|
|
94
|
+
padding-top: 5px;
|
|
95
|
+
padding-bottom: 5px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.sr-only {
|
|
99
|
+
position: absolute;
|
|
100
|
+
width: 1px;
|
|
101
|
+
height: 1px;
|
|
102
|
+
padding: 0;
|
|
103
|
+
margin: -1px;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
clip: rect(0, 0, 0, 0);
|
|
106
|
+
border: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.col {
|
|
110
|
+
width: 25%;
|
|
111
|
+
height: 25px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
svg {
|
|
115
|
+
height: 10px;
|
|
116
|
+
width: 10px;
|
|
117
|
+
display: block;
|
|
118
|
+
margin: auto;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.status-text {
|
|
122
|
+
font-size: 14px;
|
|
123
|
+
height: 15px;
|
|
124
|
+
color: #2c2c2c;
|
|
125
|
+
line-height: 20px;
|
|
126
|
+
margin: auto;
|
|
127
|
+
display: block;
|
|
128
|
+
text-align: center;
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -12,6 +12,9 @@ describe('Collection Browser', () => {
|
|
|
12
12
|
html`<collection-browser></collection-browser>`
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
+
el.baseQuery = 'hello';
|
|
16
|
+
await el.updateComplete;
|
|
17
|
+
|
|
15
18
|
const facets = el.shadowRoot?.querySelector('collection-facets');
|
|
16
19
|
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
17
20
|
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable import/no-duplicates */
|
|
2
|
+
import { expect, fixture } from '@open-wc/testing';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
import { EmptyPlaceholder } from '../src/empty-placeholder';
|
|
5
|
+
import '../src/empty-placeholder';
|
|
6
|
+
|
|
7
|
+
describe('Empty Placeholder', () => {
|
|
8
|
+
it('should render with no-search-term placeholder', async () => {
|
|
9
|
+
const el = await fixture<EmptyPlaceholder>(
|
|
10
|
+
html`<empty-placeholder></empty-placeholder>`
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
el.placeholderType = 'no-search-term';
|
|
14
|
+
await el.updateComplete;
|
|
15
|
+
|
|
16
|
+
const notSearchTerm = el.shadowRoot?.querySelector('.no-term');
|
|
17
|
+
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
18
|
+
|
|
19
|
+
expect(notSearchTerm).to.exist;
|
|
20
|
+
expect(infiniteScroller).to.not.exist;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should render with no-search-result placeholder', async () => {
|
|
24
|
+
const el = await fixture<EmptyPlaceholder>(
|
|
25
|
+
html`<empty-placeholder></empty-placeholder>`
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
el.placeholderType = 'no-search-result';
|
|
29
|
+
await el.updateComplete;
|
|
30
|
+
|
|
31
|
+
expect(el.shadowRoot?.querySelector('.no-result')).to.exist;
|
|
32
|
+
expect(el.shadowRoot?.querySelector('.no-term')).to.not.exist;
|
|
33
|
+
expect(el.shadowRoot?.querySelector('collection-facets')).to.not.exist;
|
|
34
|
+
});
|
|
35
|
+
});
|