-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/data-list-metadata
- Loading branch information
Showing
6 changed files
with
219 additions
and
4 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
50 changes: 50 additions & 0 deletions
50
...es/components/plh/plh-kids-kw/components/module-list-item/module-list-item.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,50 @@ | ||
<div class="module-item" [attr.data-lock]="params.isLocked"> | ||
@if (!params.isLocked) { | ||
<div | ||
class="container" | ||
[attr.data-language-direction]="templateTranslateService.languageDirection()" | ||
(click)="triggerActions('click')" | ||
> | ||
@if (params.moduleImageAsset) { | ||
<div class="module-image"> | ||
<img [src]="params.moduleImageAsset | plhAsset" /> | ||
</div> | ||
} | ||
@if (_row.value) { | ||
<div class="module-title"> | ||
<p [attr.data-variant]="params.textTransform">{{ _row.value }}</p> | ||
</div> | ||
} | ||
@if (params.navImageAsset !== null) { | ||
<div class="nav-icon"> | ||
<img class="icon" [src]="params.navImageAsset | plhAsset" /> | ||
</div> | ||
} @else { | ||
<div class="no-nav"></div> | ||
} | ||
</div> | ||
} @else { | ||
<div | ||
class="container" | ||
[attr.data-language-direction]="templateTranslateService.languageDirection()" | ||
> | ||
@if (params.moduleImageAsset) { | ||
<div class="module-image"> | ||
<img [src]="params.moduleImageAsset | plhAsset" /> | ||
</div> | ||
} | ||
@if (_row.value) { | ||
<div class="module-title"> | ||
<p [attr.data-variant]="params.textTransform">{{ _row.value }}</p> | ||
</div> | ||
} | ||
@if (params.lockedImageAsset !== null) { | ||
<div class="locked"> | ||
<img class="icon" [src]="params.lockedImageAsset | plhAsset" /> | ||
</div> | ||
} @else { | ||
<div class="no-nav"></div> | ||
} | ||
</div> | ||
} | ||
</div> |
Empty file.
24 changes: 24 additions & 0 deletions
24
...components/plh/plh-kids-kw/components/module-list-item/module-list-item.component.spec.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,24 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; | ||
import { IonicModule } from "@ionic/angular"; | ||
|
||
import { PlhModuleListItemComponent } from "./module-list-item.component"; | ||
|
||
describe("ModuleListItemComponent", () => { | ||
let component: PlhModuleListItemComponent; | ||
let fixture: ComponentFixture<PlhModuleListItemComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [PlhModuleListItemComponent], | ||
imports: [IonicModule.forRoot()], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(PlhModuleListItemComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it("should create", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
56 changes: 56 additions & 0 deletions
56
...ages/components/plh/plh-kids-kw/components/module-list-item/module-list-item.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,56 @@ | ||
import { Component, OnInit } from "@angular/core"; | ||
import { FlowTypes } from "packages/data-models"; | ||
import { TemplateBaseComponent } from "src/app/shared/components/template/components/base"; | ||
import { TemplateTranslateService } from "src/app/shared/components/template/services/template-translate.service"; | ||
import { | ||
getBooleanParamFromTemplateRow, | ||
getStringParamFromTemplateRow, | ||
} from "src/app/shared/utils"; | ||
|
||
interface IModuleListItemParams { | ||
/* TEMPLATE PARAMETER: "module_image_asset". The image attached to the module */ | ||
moduleImageAsset?: string; | ||
/* TEMPLATE PARAMETER: "text_transform". The format of the text on the module item. Default null */ | ||
textTransform?: "capitalise" | "uppercase"; | ||
/* TEMPLATE PARAMETER: "is_locked". The boolean that marks the module as locked or unlocked */ | ||
isLocked?: boolean; | ||
/* TEMPLATE PARAMETER: "nav_image_asset". The navigation icon*/ | ||
navImageAsset?: string; | ||
/* TEMPLATE PARAMETER: "locked_image_asset". The locked icon*/ | ||
lockedImageAsset?: string; | ||
} | ||
|
||
@Component({ | ||
selector: "plh-module-list-item", | ||
templateUrl: "./module-list-item.component.html", | ||
styleUrls: ["./module-list-item.component.scss"], | ||
}) | ||
export class PlhModuleListItemComponent extends TemplateBaseComponent implements OnInit { | ||
params: Partial<IModuleListItemParams> = {}; | ||
|
||
constructor(public templateTranslateService: TemplateTranslateService) { | ||
super(); | ||
} | ||
|
||
ngOnInit() { | ||
this.getParams(); | ||
} | ||
|
||
private getParams() { | ||
this.params.moduleImageAsset = getStringParamFromTemplateRow( | ||
this._row, | ||
"module_image_asset", | ||
"" | ||
); | ||
this.params.textTransform = getStringParamFromTemplateRow(this._row, "text_transform", null) as | ||
| "capitalise" | ||
| "uppercase"; | ||
this.params.isLocked = getBooleanParamFromTemplateRow(this._row, "is_locked", false); | ||
this.params.navImageAsset = getStringParamFromTemplateRow(this._row, "nav_image_asset", null); | ||
this.params.lockedImageAsset = getStringParamFromTemplateRow( | ||
this._row, | ||
"locked_image_asset", | ||
null | ||
); | ||
} | ||
} |
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