create-sitecore-jss 22.2.0-canary.7 → 22.2.0-canary.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.
@@ -0,0 +1,15 @@
1
+ <div class="container-wrapper" *ngIf="wrapped; else default">
2
+ <ng-container *ngTemplateOutlet="default"></ng-container>
3
+ </div>
4
+ <ng-template #default>
5
+ <div class="component container-default {{ styles }}" [attr.id]="id">
6
+ <div class="component-content" [ngStyle]="backgroundStyle">
7
+ <div class="row">
8
+ <sc-placeholder
9
+ [name]="placeholderName"
10
+ [rendering]="rendering">
11
+ </sc-placeholder>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ </ng-template>
@@ -0,0 +1,30 @@
1
+ import { Component, OnInit } from '@angular/core';
2
+ import { SxaComponent } from '../sxa.component';
3
+
4
+ @Component({
5
+ selector: 'app-container',
6
+ templateUrl: './container.component.html',
7
+ })
8
+ export class ContainerComponent extends SxaComponent implements OnInit {
9
+ placeholderName: string;
10
+ wrapped: boolean;
11
+
12
+ override ngOnInit() {
13
+ super.ngOnInit();
14
+
15
+ this.placeholderName = `container-${this.rendering.params?.DynamicPlaceholderId}`;
16
+ this.wrapped = this.rendering.params?.Styles?.split(' ').includes('container');
17
+ }
18
+
19
+ get backgroundStyle() {
20
+ const backgroundImage = this.rendering.params?.BackgroundImage;
21
+ const mediaUrlPattern = new RegExp(/mediaurl=\"([^"]*)\"/, 'i');
22
+ if (!backgroundImage || !backgroundImage.match(mediaUrlPattern)) {
23
+ return {};
24
+ }
25
+ const mediaUrl = backgroundImage.match(mediaUrlPattern)[1];
26
+ return {
27
+ backgroundImage: `url('${mediaUrl}')`,
28
+ };
29
+ }
30
+ }
@@ -1,4 +1,4 @@
1
- import { OnInit, Input, Directive } from '@angular/core';
1
+ import { OnInit, Input, Directive } from '@angular/core';
2
2
  import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
3
3
 
4
4
  @Directive()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sitecore-jss",
3
- "version": "22.2.0-canary.7",
3
+ "version": "22.2.0-canary.8",
4
4
  "description": "Sitecore JSS initializer",
5
5
  "bin": "./dist/index.js",
6
6
  "scripts": {
@@ -63,5 +63,5 @@
63
63
  "ts-node": "^10.9.1",
64
64
  "typescript": "~4.9.5"
65
65
  },
66
- "gitHead": "237c6c99e1a13e30447f09ce710e543b2b999096"
66
+ "gitHead": "755525262fcb998452876d2f28a57d130e29731c"
67
67
  }