David Taylor 48193767bf DEV: Sort imports
Automatically generated by `eslint --fix` to satisfy the updated configuration
2023-10-10 21:46:54 +01:00

32 lines
704 B
JavaScript

import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { htmlSafe } from "@ember/template";
export default class LazyVideo extends Component {
@tracked isLoaded = false;
@action
loadEmbed() {
if (!this.isLoaded) {
this.isLoaded = true;
this.args.onLoadedVideo?.();
}
}
@action
onKeyPress(event) {
if (event.key === "Enter") {
event.preventDefault();
this.loadEmbed();
}
}
get thumbnailStyle() {
const color = this.args.videoAttributes.dominantColor;
if (color?.match(/^[0-9A-Fa-f]+$/)) {
return htmlSafe(`background-color: #${color};`);
}
}
}