@gouvfr/dsfr-nexus
Version:
Le module `dsfr-nexus` est l'interface de ligne de commande (CLI) centrale du Système de Design de l’État - DSFR. Il offre des outils pour gérer et compiler les ressources du DSFR
58 lines (47 loc) • 1.4 kB
JavaScript
import { DirectiveNode } from '../directive-node.js';
class HpSliceVideoContainerDirectiveNode extends DirectiveNode {
constructor (data, state) {
super(data, state);
const img = this.getStringProperty('img');
this._asset = this.addAsset(img);
const imgDark = this.getStringProperty('imgDark');
if (imgDark) this._assetDark = this.addAsset(imgDark);
const imgBg = this.getStringProperty('imgBg');
if (imgBg) this._imgBgUrl = this.addAsset(imgBg);
const imgBgDark = this.getStringProperty('imgBgDark');
if (imgBgDark) this._imgDarkBgUrl = this.addAsset(imgBgDark);
this._provider = this.getStringProperty('provider');
this._videoId = this.getStringProperty('videoId');
}
get imgUrl () {
return this._asset;
}
get imgDarkUrl () {
return this._assetDark;
}
get imgBgUrl () {
return this._imgBgUrl;
}
get imgDarkBgUrl () {
return this._imgDarkBgUrl;
}
get provider () {
return this._provider;
}
get videoId () {
return this._videoId;
}
get data () {
return {
...super.data,
imgUrl: this.imgUrl,
imgDarkUrl: this.imgDarkUrl,
imgBgUrl: this._imgBgUrl,
imgDarkBgUrl: this._imgDarkBgUrl,
provider: this.provider,
videoId: this.videoId,
};
}
}
HpSliceVideoContainerDirectiveNode.NAME = 'hp-slice-video';
export { HpSliceVideoContainerDirectiveNode };