-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[angular-xmcloud] Introduce RowSplitter SXA component (#1901)
- Loading branch information
1 parent
7fba0bc
commit e00cdb0
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...src/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="component row-splitter" [ngClass]="rowSplitterStyles" [attr.id]="id"> | ||
<div *ngFor="let ph of enabledPlaceholders" class="container-fluid" [ngClass]="getRowClass(+ph - 1)"> | ||
<div> | ||
<div class="row"> | ||
<sc-placeholder [name]="getPlaceholderName(ph)" [rendering]="rendering"> | ||
</sc-placeholder> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
30 changes: 30 additions & 0 deletions
30
...s/src/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component } from '@angular/core'; | ||
import { SxaComponent } from '../sxa.component'; | ||
|
||
@Component({ | ||
selector: 'app-row-splitter', | ||
templateUrl: './row-splitter.component.html', | ||
}) | ||
export class RowSplitterComponent extends SxaComponent { | ||
get rowSplitterStyles(): string { | ||
return `${this.rendering.params.GridParameters ?? ''} ${this.rendering.params.Styles ?? | ||
''}`.trimEnd(); | ||
} | ||
|
||
get rowStyles(): string[] { | ||
return Array.from({ length: 8 }, (_, i) => this.rendering.params[`Styles${i + 1}`]); | ||
} | ||
|
||
get enabledPlaceholders(): string[] { | ||
return this.rendering.params.EnabledPlaceholders.split(','); | ||
} | ||
|
||
getRowClass(index: number): string { | ||
const styleClass = this.rowStyles[index] || ''; | ||
return `${styleClass}`.trim(); | ||
} | ||
|
||
getPlaceholderName(ph: string): string { | ||
return `row-${ph}-{*}`; | ||
} | ||
} |