Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kuwait Theme: Module Details Header #2546

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/components/plh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@ import { PlhParentPointCounterComponent } from "./parent-point-counter/parent-po
import { PlhParentPointBoxComponent } from "./parent-point-box/parent-point-box.component";
import { PlhModuleListItemComponent } from "./plh-kids-kw/components/module-list-item/module-list-item.component";
import { RouterModule } from "@angular/router";
import { PlhModuleDetailsHeaderComponent } from "./plh-kids-kw/components/module-details-header/module-details-header.component";

@NgModule({
imports: [CommonModule, IonicModule, TemplatePipesModule, LottieModule, RouterModule],
exports: [PlhParentPointCounterComponent, PlhParentPointBoxComponent, PlhModuleListItemComponent],
exports: [
PlhParentPointCounterComponent,
PlhParentPointBoxComponent,
PlhModuleListItemComponent,
PlhModuleDetailsHeaderComponent,
],
declarations: [
PlhParentPointCounterComponent,
PlhParentPointBoxComponent,
PlhModuleListItemComponent,
PlhModuleDetailsHeaderComponent,
],
providers: [],
})
Expand All @@ -25,5 +32,6 @@ export class PlhComponentsModule {}
export const PLH_COMPONENT_MAPPING: Record<string, Type<ITemplateRowProps>> = {
parent_point_counter: PlhParentPointCounterComponent,
parent_point_box: PlhParentPointBoxComponent,
plh_module_details_header: PlhModuleDetailsHeaderComponent,
plh_module_list_item: PlhModuleListItemComponent,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="module-header">
<div
class="wrapper"
[attr.data-language-direction]="templateTranslateService.languageDirection()"
>
<div class="image">
@if (params.moduleImageAsset) {
<div
class="module-illustration"
[style.backgroundImage]="'url(' + (params.bgImage | plhAsset) + ')'"
>
<img [src]="params.moduleImageAsset | plhAsset" class="module-image" />
</div>
}
</div>
@if (_row.value) {
<div class="module-title">
<h2>{{ _row.value }}</h2>
</div>
}
</div>
</div>
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 { PlhModuleDetailsHeaderComponent } from "./module-details-header.component";

describe("ModuleDetailsHeaderComponent", () => {
let component: PlhModuleDetailsHeaderComponent;
let fixture: ComponentFixture<PlhModuleDetailsHeaderComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [PlhModuleDetailsHeaderComponent],
imports: [IonicModule.forRoot()],
}).compileComponents();

fixture = TestBed.createComponent(PlhModuleDetailsHeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));

it("should create", () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Component, OnInit } from "@angular/core";
import { TemplateBaseComponent } from "src/app/shared/components/template/components/base";
import { TemplateTranslateService } from "src/app/shared/components/template/services/template-translate.service";
import { getParamFromTemplateRow, getStringParamFromTemplateRow } from "src/app/shared/utils";

interface IModuleHeaderParams {
bgImage?: string;
moduleImageAsset?: string;
}
@Component({
selector: "plh-module-details-header",
templateUrl: "./module-details-header.component.html",
styleUrls: ["./module-details-header.component.scss"],
})
export class PlhModuleDetailsHeaderComponent extends TemplateBaseComponent implements OnInit {
params: Partial<IModuleHeaderParams> = {};

constructor(public templateTranslateService: TemplateTranslateService) {
super();
}

ngOnInit() {
this.getParams();
}

private getParams() {
this.params.bgImage = getStringParamFromTemplateRow(this._row, "background_illustration", null);
this.params.moduleImageAsset = getStringParamFromTemplateRow(
this._row,
"module_image_asset",
null
);
}
}
40 changes: 40 additions & 0 deletions src/theme/themes/plh_kids_kw/_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,46 @@ body[data-theme="plh_kids_kw"] {
}
}

// module header
plh-module-details-header {
.module-header {
border-bottom-left-radius: 40px;
border-bottom-right-radius: 40px;
background-color: #9ecbf5;
}
.image {
.module-illustration {
height: 480px;
background-position: center;
background-repeat: no-repeat;
background-size: 380px;

display: flex;
justify-content: center;
align-items: center;
}
img.module-image {
max-width: 220px;
min-width: 220px;
margin-top: -40px;
}
}
.module-title {
margin-top: -70px;
padding-bottom: 30px;
padding-left: 16px;
h2 {
font-weight: var(--font-weight-bold);
font-size: 28px;
}
}
.wrapper[data-language-direction~="rtl"] {
.module-title {
padding-right: 16px;
}
}
}

// module-list-item
plh-module-list-item {
.module-item {
Expand Down
Loading