-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsta-arrow.js
More file actions
95 lines (87 loc) · 2.39 KB
/
insta-arrow.js
File metadata and controls
95 lines (87 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// I will put the arrows here that can be clicked and change the slide of the playlist
/**
* Copyright 2026 interested-learner
* @license Apache-2.0, see LICENSE for full text.
*/
import { LitElement, html, css } from "lit";
import { DDDSuper } from "@haxtheweb/d-d-d/d-d-d.js";
import { I18NMixin } from "@haxtheweb/i18n-manager/lib/I18NMixin.js";
/**
* `play-list-project`
*
* @demo index.html
* @element play-list-project
*/
export class PlayListArrow extends DDDSuper(I18NMixin(LitElement)) {
static get tag() {
return "insta-arrow";
}
constructor() {
super();
this.index = 0;
this.total = 0;
this.direction = "next";
}
// Lit reactive properties
static get properties() {
return {
...super.properties,
index : { type: Number },
total : { type: Number },
direction : { type: String },
};
}
// Lit scoped styles
static get styles() {
return [super.styles,
css`
:host {
display: block;
}
.wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding: var(--ddd-spacing-2);
}
button {
background-color: white;
color: var(--ddd-theme-default-beaverBlue);
border: var(--ddd-border-size-sm) solid var(--ddd-theme-default-beaverBlue);
border-radius: var(--ddd-radius-circle);
width: var(--ddd-icon-sm);
height: var(--ddd-icon-sm);
cursor: pointer;
font-size: var(--ddd-font-size-3xs);
display: flex;
align-items: center;
justify-content: center;
}
button:hover {
opacity: 0.8;
}
button:disabled {
opacity: 0.3;
cursor: not-allowed;
background-color: var(--ddd-theme-default-white);
}
`];
}
// Lit render the HTML
render() {
if (this.direction === "prev") {
return html`
<button ?disabled="${this.index === 0}"
@click=${() => this.dispatchEvent(new CustomEvent('prev-clicked', {bubbles: true, composed: true}))}>
❮
</button>`;
} else {
return html`
<button ?disabled="${this.index === this.total - 1}"
@click=${() => this.dispatchEvent(new CustomEvent('next-clicked', {bubbles: true, composed: true}))}>
❯
</button>`;
}
}
}
globalThis.customElements.define(PlayListArrow.tag, PlayListArrow);