@internetarchive/collection-browser 3.1.1-alpha-webdev6778.7 → 3.1.1-alpha-webdev6778.8
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/app-root.js +606 -606
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +140 -140
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/models.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +1 -3
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/expanded-date-picker.js +52 -52
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/manage/manage-bar.js +77 -77
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/models.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +376 -376
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +36 -36
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +42 -42
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +97 -97
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/utils/analytics-events.js.map +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/test/collection-browser.test.js +187 -187
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +23 -23
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +20 -20
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +37 -37
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +64 -64
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +57 -57
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/package.json +1 -1
- package/src/app-root.ts +1140 -1140
- package/src/collection-browser.ts +1 -1
- package/src/collection-facets/facet-row.ts +296 -296
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
- package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
- package/src/data-source/collection-browser-data-source-interface.ts +333 -333
- package/src/data-source/collection-browser-data-source.ts +2 -4
- package/src/data-source/models.ts +43 -43
- package/src/expanded-date-picker.ts +191 -191
- package/src/manage/manage-bar.ts +247 -247
- package/src/models.ts +870 -870
- package/src/sort-filter-bar/sort-filter-bar.ts +1283 -1283
- package/src/tiles/base-tile-component.ts +53 -53
- package/src/tiles/grid/account-tile.ts +112 -112
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/src/tiles/list/tile-list-compact.ts +236 -236
- package/src/utils/analytics-events.ts +29 -29
- package/src/utils/format-date.ts +42 -42
- package/test/collection-browser.test.ts +2359 -2359
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/sort-filter-bar/sort-filter-bar.test.ts +885 -885
- package/test/tiles/grid/item-tile.test.ts +464 -464
- package/test/tiles/list/tile-list-compact.test.ts +228 -228
- package/test/utils/format-date.test.ts +39 -39
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import type { SortParam } from '@internetarchive/search-service';
|
|
4
|
-
import { TileDisplayValueProvider } from './tile-display-value-provider';
|
|
5
|
-
import type { TileModel } from '../models';
|
|
6
|
-
|
|
7
|
-
export abstract class BaseTileComponent extends LitElement {
|
|
8
|
-
@property({ type: Object }) model?: TileModel;
|
|
9
|
-
|
|
10
|
-
@property({ type: Number }) currentWidth?: number;
|
|
11
|
-
|
|
12
|
-
@property({ type: Number }) currentHeight?: number;
|
|
13
|
-
|
|
14
|
-
@property({ type: String }) baseNavigationUrl?: string;
|
|
15
|
-
|
|
16
|
-
@property({ type: String }) baseImageUrl?: string;
|
|
17
|
-
|
|
18
|
-
@property({ type: String }) collectionPagePath?: string;
|
|
19
|
-
|
|
20
|
-
@property({ type: Object }) sortParam: SortParam | null = null;
|
|
21
|
-
|
|
22
|
-
@property({ type: Object }) defaultSortParam: SortParam | null = null;
|
|
23
|
-
|
|
24
|
-
@property({ type: String }) creatorFilter?: string;
|
|
25
|
-
|
|
26
|
-
@property({ type: Number }) mobileBreakpoint?: number;
|
|
27
|
-
|
|
28
|
-
@property({ type: Boolean }) loggedIn = false;
|
|
29
|
-
|
|
30
|
-
@property({ type: Boolean }) suppressBlurring = false;
|
|
31
|
-
|
|
32
|
-
protected displayValueProvider = new TileDisplayValueProvider();
|
|
33
|
-
|
|
34
|
-
protected willUpdate(changed: PropertyValues<this>) {
|
|
35
|
-
// Ensure the TileDisplayValueProvider stays up-to-date as properties change
|
|
36
|
-
if (
|
|
37
|
-
changed.has('model') ||
|
|
38
|
-
changed.has('baseNavigationUrl') ||
|
|
39
|
-
changed.has('collectionPagePath') ||
|
|
40
|
-
changed.has('sortParam') ||
|
|
41
|
-
changed.has('defaultSortParam') ||
|
|
42
|
-
changed.has('creatorFilter')
|
|
43
|
-
) {
|
|
44
|
-
this.displayValueProvider = new TileDisplayValueProvider({
|
|
45
|
-
model: this.model,
|
|
46
|
-
baseNavigationUrl: this.baseNavigationUrl,
|
|
47
|
-
collectionPagePath: this.collectionPagePath,
|
|
48
|
-
sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
|
|
49
|
-
creatorFilter: this.creatorFilter,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import type { SortParam } from '@internetarchive/search-service';
|
|
4
|
+
import { TileDisplayValueProvider } from './tile-display-value-provider';
|
|
5
|
+
import type { TileModel } from '../models';
|
|
6
|
+
|
|
7
|
+
export abstract class BaseTileComponent extends LitElement {
|
|
8
|
+
@property({ type: Object }) model?: TileModel;
|
|
9
|
+
|
|
10
|
+
@property({ type: Number }) currentWidth?: number;
|
|
11
|
+
|
|
12
|
+
@property({ type: Number }) currentHeight?: number;
|
|
13
|
+
|
|
14
|
+
@property({ type: String }) baseNavigationUrl?: string;
|
|
15
|
+
|
|
16
|
+
@property({ type: String }) baseImageUrl?: string;
|
|
17
|
+
|
|
18
|
+
@property({ type: String }) collectionPagePath?: string;
|
|
19
|
+
|
|
20
|
+
@property({ type: Object }) sortParam: SortParam | null = null;
|
|
21
|
+
|
|
22
|
+
@property({ type: Object }) defaultSortParam: SortParam | null = null;
|
|
23
|
+
|
|
24
|
+
@property({ type: String }) creatorFilter?: string;
|
|
25
|
+
|
|
26
|
+
@property({ type: Number }) mobileBreakpoint?: number;
|
|
27
|
+
|
|
28
|
+
@property({ type: Boolean }) loggedIn = false;
|
|
29
|
+
|
|
30
|
+
@property({ type: Boolean }) suppressBlurring = false;
|
|
31
|
+
|
|
32
|
+
protected displayValueProvider = new TileDisplayValueProvider();
|
|
33
|
+
|
|
34
|
+
protected willUpdate(changed: PropertyValues<this>) {
|
|
35
|
+
// Ensure the TileDisplayValueProvider stays up-to-date as properties change
|
|
36
|
+
if (
|
|
37
|
+
changed.has('model') ||
|
|
38
|
+
changed.has('baseNavigationUrl') ||
|
|
39
|
+
changed.has('collectionPagePath') ||
|
|
40
|
+
changed.has('sortParam') ||
|
|
41
|
+
changed.has('defaultSortParam') ||
|
|
42
|
+
changed.has('creatorFilter')
|
|
43
|
+
) {
|
|
44
|
+
this.displayValueProvider = new TileDisplayValueProvider({
|
|
45
|
+
model: this.model,
|
|
46
|
+
baseNavigationUrl: this.baseNavigationUrl,
|
|
47
|
+
collectionPagePath: this.collectionPagePath,
|
|
48
|
+
sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
|
|
49
|
+
creatorFilter: this.creatorFilter,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
import { css, html, nothing, TemplateResult } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { msg } from '@lit/localize';
|
|
4
|
-
import { BaseTileComponent } from '../base-tile-component';
|
|
5
|
-
|
|
6
|
-
import { baseTileStyles } from './styles/tile-grid-shared-styles';
|
|
7
|
-
import '../image-block';
|
|
8
|
-
import './tile-stats';
|
|
9
|
-
|
|
10
|
-
@customElement('account-tile')
|
|
11
|
-
export class AccountTile extends BaseTileComponent {
|
|
12
|
-
/*
|
|
13
|
-
* Reactive properties inherited from BaseTileComponent:
|
|
14
|
-
* - model?: TileModel;
|
|
15
|
-
* - currentWidth?: number;
|
|
16
|
-
* - currentHeight?: number;
|
|
17
|
-
* - baseNavigationUrl?: string;
|
|
18
|
-
* - baseImageUrl?: string;
|
|
19
|
-
* - collectionPagePath?: string;
|
|
20
|
-
* - sortParam: SortParam | null = null;
|
|
21
|
-
* - creatorFilter?: string;
|
|
22
|
-
* - mobileBreakpoint?: number;
|
|
23
|
-
* - loggedIn = false;
|
|
24
|
-
* - suppressBlurring = false;
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
@property({ type: Boolean }) showInfoButton = false;
|
|
28
|
-
|
|
29
|
-
render() {
|
|
30
|
-
return html`
|
|
31
|
-
<div class="container">
|
|
32
|
-
${this.infoButtonTemplate}
|
|
33
|
-
<div class="tile-details">
|
|
34
|
-
<div class="item-info">
|
|
35
|
-
${this.getAvatarTemplate} ${this.getTitleTemplate}
|
|
36
|
-
${this.getArchivistTemplate}
|
|
37
|
-
</div>
|
|
38
|
-
${this.getTileStatsTemplate}
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private get getAvatarTemplate(): TemplateResult {
|
|
45
|
-
return html`
|
|
46
|
-
<image-block
|
|
47
|
-
.model=${this.model}
|
|
48
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
49
|
-
.viewSize=${'grid'}
|
|
50
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
51
|
-
>
|
|
52
|
-
</image-block>
|
|
53
|
-
`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private get getTitleTemplate() {
|
|
57
|
-
return html`<div id="title">
|
|
58
|
-
<h4 class="truncated">${this.model?.identifier}</h4>
|
|
59
|
-
</div>`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private get getArchivistTemplate() {
|
|
63
|
-
return html`<div class="archivist-since">
|
|
64
|
-
<span>${this.displayValueProvider.accountLabel}</span>
|
|
65
|
-
</div>`;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
private get getTileStatsTemplate() {
|
|
69
|
-
return html`<tile-stats
|
|
70
|
-
.mediatype=${this.model?.mediatype}
|
|
71
|
-
.itemCount=${this.model?.itemCount}
|
|
72
|
-
.favCount=${this.model?.favCount}
|
|
73
|
-
.commentCount=${this.model?.commentCount}
|
|
74
|
-
>
|
|
75
|
-
</tile-stats>`;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private get infoButtonTemplate(): TemplateResult | typeof nothing {
|
|
79
|
-
// ⓘ is an information icon
|
|
80
|
-
return this.showInfoButton
|
|
81
|
-
? html`<button class="info-button" @click=${this.infoButtonPressed}>
|
|
82
|
-
ⓘ
|
|
83
|
-
<span class="sr-only">${msg('More info')}</span>
|
|
84
|
-
</button>`
|
|
85
|
-
: nothing;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private infoButtonPressed(e: PointerEvent) {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
const event = new CustomEvent<{ x: number; y: number }>(
|
|
91
|
-
'infoButtonPressed',
|
|
92
|
-
{ detail: { x: e.clientX, y: e.clientY } },
|
|
93
|
-
);
|
|
94
|
-
this.dispatchEvent(event);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* CSS
|
|
99
|
-
*/
|
|
100
|
-
static get styles() {
|
|
101
|
-
const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;
|
|
102
|
-
|
|
103
|
-
return [
|
|
104
|
-
baseTileStyles,
|
|
105
|
-
css`
|
|
106
|
-
.container {
|
|
107
|
-
border: 1px solid ${tileBorderColor};
|
|
108
|
-
}
|
|
109
|
-
`,
|
|
110
|
-
];
|
|
111
|
-
}
|
|
112
|
-
}
|
|
1
|
+
import { css, html, nothing, TemplateResult } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { msg } from '@lit/localize';
|
|
4
|
+
import { BaseTileComponent } from '../base-tile-component';
|
|
5
|
+
|
|
6
|
+
import { baseTileStyles } from './styles/tile-grid-shared-styles';
|
|
7
|
+
import '../image-block';
|
|
8
|
+
import './tile-stats';
|
|
9
|
+
|
|
10
|
+
@customElement('account-tile')
|
|
11
|
+
export class AccountTile extends BaseTileComponent {
|
|
12
|
+
/*
|
|
13
|
+
* Reactive properties inherited from BaseTileComponent:
|
|
14
|
+
* - model?: TileModel;
|
|
15
|
+
* - currentWidth?: number;
|
|
16
|
+
* - currentHeight?: number;
|
|
17
|
+
* - baseNavigationUrl?: string;
|
|
18
|
+
* - baseImageUrl?: string;
|
|
19
|
+
* - collectionPagePath?: string;
|
|
20
|
+
* - sortParam: SortParam | null = null;
|
|
21
|
+
* - creatorFilter?: string;
|
|
22
|
+
* - mobileBreakpoint?: number;
|
|
23
|
+
* - loggedIn = false;
|
|
24
|
+
* - suppressBlurring = false;
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
@property({ type: Boolean }) showInfoButton = false;
|
|
28
|
+
|
|
29
|
+
render() {
|
|
30
|
+
return html`
|
|
31
|
+
<div class="container">
|
|
32
|
+
${this.infoButtonTemplate}
|
|
33
|
+
<div class="tile-details">
|
|
34
|
+
<div class="item-info">
|
|
35
|
+
${this.getAvatarTemplate} ${this.getTitleTemplate}
|
|
36
|
+
${this.getArchivistTemplate}
|
|
37
|
+
</div>
|
|
38
|
+
${this.getTileStatsTemplate}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private get getAvatarTemplate(): TemplateResult {
|
|
45
|
+
return html`
|
|
46
|
+
<image-block
|
|
47
|
+
.model=${this.model}
|
|
48
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
49
|
+
.viewSize=${'grid'}
|
|
50
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
51
|
+
>
|
|
52
|
+
</image-block>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private get getTitleTemplate() {
|
|
57
|
+
return html`<div id="title">
|
|
58
|
+
<h4 class="truncated">${this.model?.identifier}</h4>
|
|
59
|
+
</div>`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private get getArchivistTemplate() {
|
|
63
|
+
return html`<div class="archivist-since">
|
|
64
|
+
<span>${this.displayValueProvider.accountLabel}</span>
|
|
65
|
+
</div>`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private get getTileStatsTemplate() {
|
|
69
|
+
return html`<tile-stats
|
|
70
|
+
.mediatype=${this.model?.mediatype}
|
|
71
|
+
.itemCount=${this.model?.itemCount}
|
|
72
|
+
.favCount=${this.model?.favCount}
|
|
73
|
+
.commentCount=${this.model?.commentCount}
|
|
74
|
+
>
|
|
75
|
+
</tile-stats>`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private get infoButtonTemplate(): TemplateResult | typeof nothing {
|
|
79
|
+
// ⓘ is an information icon
|
|
80
|
+
return this.showInfoButton
|
|
81
|
+
? html`<button class="info-button" @click=${this.infoButtonPressed}>
|
|
82
|
+
ⓘ
|
|
83
|
+
<span class="sr-only">${msg('More info')}</span>
|
|
84
|
+
</button>`
|
|
85
|
+
: nothing;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private infoButtonPressed(e: PointerEvent) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
const event = new CustomEvent<{ x: number; y: number }>(
|
|
91
|
+
'infoButtonPressed',
|
|
92
|
+
{ detail: { x: e.clientX, y: e.clientY } },
|
|
93
|
+
);
|
|
94
|
+
this.dispatchEvent(event);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* CSS
|
|
99
|
+
*/
|
|
100
|
+
static get styles() {
|
|
101
|
+
const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;
|
|
102
|
+
|
|
103
|
+
return [
|
|
104
|
+
baseTileStyles,
|
|
105
|
+
css`
|
|
106
|
+
.container {
|
|
107
|
+
border: 1px solid ${tileBorderColor};
|
|
108
|
+
}
|
|
109
|
+
`,
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, TemplateResult } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { baseTileStyles } from './styles/tile-grid-shared-styles';
|
|
4
|
-
import { BaseTileComponent } from '../base-tile-component';
|
|
5
|
-
import '../image-block';
|
|
6
|
-
|
|
7
|
-
@customElement('search-tile')
|
|
8
|
-
export class SearchTile extends BaseTileComponent {
|
|
9
|
-
/*
|
|
10
|
-
* Reactive properties inherited from BaseTileComponent:
|
|
11
|
-
* - model?: TileModel;
|
|
12
|
-
* - currentWidth?: number;
|
|
13
|
-
* - currentHeight?: number;
|
|
14
|
-
* - baseNavigationUrl?: string;
|
|
15
|
-
* - baseImageUrl?: string;
|
|
16
|
-
* - collectionPagePath?: string;
|
|
17
|
-
* - sortParam: SortParam | null = null;
|
|
18
|
-
* - creatorFilter?: string;
|
|
19
|
-
* - mobileBreakpoint?: number;
|
|
20
|
-
* - loggedIn = false;
|
|
21
|
-
* - suppressBlurring = false;
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
@property({ type: Boolean }) showInfoButton = false;
|
|
25
|
-
|
|
26
|
-
render() {
|
|
27
|
-
return html`
|
|
28
|
-
<div class="container">
|
|
29
|
-
<div class="tile-details">
|
|
30
|
-
<div class="item-info">
|
|
31
|
-
${this.getImageBlockTemplate} ${this.getTitleTemplate}
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
`;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
private get getImageBlockTemplate(): TemplateResult {
|
|
39
|
-
return html`
|
|
40
|
-
<image-block
|
|
41
|
-
.model=${this.model}
|
|
42
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
43
|
-
.viewSize=${'grid'}
|
|
44
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
45
|
-
>
|
|
46
|
-
</image-block>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private get getTitleTemplate() {
|
|
51
|
-
return html`<div id="title">
|
|
52
|
-
<h3 class="truncated">${this.model?.title}</h3>
|
|
53
|
-
</div>`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
static get styles(): CSSResultGroup {
|
|
57
|
-
const tileBorderColor = css`var(--tileBorderColor, #555555)`;
|
|
58
|
-
const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;
|
|
59
|
-
const whiteColor = css`#fff`;
|
|
60
|
-
|
|
61
|
-
return [
|
|
62
|
-
baseTileStyles,
|
|
63
|
-
css`
|
|
64
|
-
.container {
|
|
65
|
-
background-color: ${tileBackgroundColor};
|
|
66
|
-
border: 1px solid ${tileBorderColor};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.item-info {
|
|
70
|
-
flex-grow: initial;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
h4.truncated,
|
|
74
|
-
h3.truncated {
|
|
75
|
-
color: ${whiteColor};
|
|
76
|
-
-webkit-line-clamp: 4;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.container:hover > #title {
|
|
80
|
-
text-decoration: underline;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/* this is a workaround for Safari 15 where the hover effects are not working */
|
|
84
|
-
image-block:hover > #title {
|
|
85
|
-
text-decoration: underline;
|
|
86
|
-
}
|
|
87
|
-
`,
|
|
88
|
-
];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
import { css, CSSResultGroup, html, TemplateResult } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { baseTileStyles } from './styles/tile-grid-shared-styles';
|
|
4
|
+
import { BaseTileComponent } from '../base-tile-component';
|
|
5
|
+
import '../image-block';
|
|
6
|
+
|
|
7
|
+
@customElement('search-tile')
|
|
8
|
+
export class SearchTile extends BaseTileComponent {
|
|
9
|
+
/*
|
|
10
|
+
* Reactive properties inherited from BaseTileComponent:
|
|
11
|
+
* - model?: TileModel;
|
|
12
|
+
* - currentWidth?: number;
|
|
13
|
+
* - currentHeight?: number;
|
|
14
|
+
* - baseNavigationUrl?: string;
|
|
15
|
+
* - baseImageUrl?: string;
|
|
16
|
+
* - collectionPagePath?: string;
|
|
17
|
+
* - sortParam: SortParam | null = null;
|
|
18
|
+
* - creatorFilter?: string;
|
|
19
|
+
* - mobileBreakpoint?: number;
|
|
20
|
+
* - loggedIn = false;
|
|
21
|
+
* - suppressBlurring = false;
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
@property({ type: Boolean }) showInfoButton = false;
|
|
25
|
+
|
|
26
|
+
render() {
|
|
27
|
+
return html`
|
|
28
|
+
<div class="container">
|
|
29
|
+
<div class="tile-details">
|
|
30
|
+
<div class="item-info">
|
|
31
|
+
${this.getImageBlockTemplate} ${this.getTitleTemplate}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private get getImageBlockTemplate(): TemplateResult {
|
|
39
|
+
return html`
|
|
40
|
+
<image-block
|
|
41
|
+
.model=${this.model}
|
|
42
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
43
|
+
.viewSize=${'grid'}
|
|
44
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
45
|
+
>
|
|
46
|
+
</image-block>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private get getTitleTemplate() {
|
|
51
|
+
return html`<div id="title">
|
|
52
|
+
<h3 class="truncated">${this.model?.title}</h3>
|
|
53
|
+
</div>`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static get styles(): CSSResultGroup {
|
|
57
|
+
const tileBorderColor = css`var(--tileBorderColor, #555555)`;
|
|
58
|
+
const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;
|
|
59
|
+
const whiteColor = css`#fff`;
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
baseTileStyles,
|
|
63
|
+
css`
|
|
64
|
+
.container {
|
|
65
|
+
background-color: ${tileBackgroundColor};
|
|
66
|
+
border: 1px solid ${tileBorderColor};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.item-info {
|
|
70
|
+
flex-grow: initial;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
h4.truncated,
|
|
74
|
+
h3.truncated {
|
|
75
|
+
color: ${whiteColor};
|
|
76
|
+
-webkit-line-clamp: 4;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.container:hover > #title {
|
|
80
|
+
text-decoration: underline;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* this is a workaround for Safari 15 where the hover effects are not working */
|
|
84
|
+
image-block:hover > #title {
|
|
85
|
+
text-decoration: underline;
|
|
86
|
+
}
|
|
87
|
+
`,
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
}
|