Skip to content

Commit

Permalink
Karma programs v2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
venkykandagaddala committed Aug 1, 2024
1 parent b0df688 commit 26303a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,12 @@ <h1 class=" txt-ellipsis-2 break-words">{{data?.title}}</h1>
</ng-container>

<ng-container *ngIf="data?.versioning">
<!-- <div class="banner-new" [ngStyle]="{'background-image': 'url(' + currentImageUrl + ')'}">
</div> -->
<div>
<img i18n-alt alt="Page Banner"
[src]="data.bannerImagesV2"
wsUtilsImageResponsive
class="banner-image-v2"/>
</div>
</div>
<div class="container-balanced pt-8">
<div class="description-v2" [innerHTML]="richTextContent(data?.descriptionV2)"></div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,39 +114,4 @@
.banner-image-v2 {
width: 100%;
height: 100%;
}

@media screen and (min-width: 344px) and (max-width: 882px) {
.banner-new {
height: 250px;
}
.description-v2 {
padding: 0 15px;
}
}

@media screen and (min-width: 430px) and (max-width: 932px) {
.banner-new {
height: 260px;
}
.description-v2 {
padding: 0 15px;
}
}
@media screen and (min-width: 540px) and (max-width: 720px) {
.banner-new {
height: 325px;
}
.description-v2 {
padding: 0 15px;
}
}

@media screen and (min-width: 768px) and (max-width: 1180px) {
.banner-new {
height: 320px;
}
.description-v2 {
padding: 0 15px;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, HostListener, OnInit } from '@angular/core'
import { Component, OnInit } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { CommonMethodsService } from '@sunbird-cb/consumption'
import { KarmaProgramsService } from '../service/karma-programs.service'
Expand Down Expand Up @@ -65,50 +65,15 @@ export class KarmaProgramsMicrositeV2Component implements OnInit {
&& this.route.snapshot.data.formData.data.result.form.data.sectionList
) {
this.sectionList = this.route.snapshot.data.formData.data.result.form.data.sectionList
let bannerSection = this.sectionList.find((ele: any) => ele.key === 'bannerSection' && ele.enabled)
if (bannerSection && bannerSection.column[0] &&
bannerSection.column[0].data && bannerSection.column[0].data.versioning) {
this.bannerImages = this.sectionList[0].column[0].data.bannerImagesV2
if (this.bannerImages) {
this.setBackgroundImage()
}
}
// if (this.sectionList[0] && this.sectionList[0].enabled && this.sectionList[0].column[0] &&
// this.sectionList[0].column[0].data &&
// this.sectionList[0].column[0].data.versioning) {
// this.bannerImages = this.sectionList[0].column[0].data.bannerImagesV2
// if (this.bannerImages) {
// this.setBackgroundImage()
// }
// }
this.getDataFromSearch()
}

}

@HostListener('window:resize', ['$event'])
onResize() {
this.setBackgroundImage();
}


richTextContent(content: any) {
return this.sanitizer.bypassSecurityTrustHtml(content)
}

setBackgroundImage() {
const width = window.innerWidth;
if (width < 380) {
this.currentImageUrl = this.bannerImages.s;
} else if (width >= 380 && width < 600) {
this.currentImageUrl = this.bannerImages.m;
} else if (width >= 600 && width < 900) {
this.currentImageUrl = this.bannerImages.l;
} else if (width >= 900 && width < 1200) {
this.currentImageUrl = this.bannerImages.xl;
} else {
this.currentImageUrl = this.bannerImages.xxl;
}
}
async getDataFromSearch(requestData?: any) {
const request = requestData || this.formRequest()
const sectionData = this.sectionList.filter((ele: any) => ele.key === 'contentSearch')
Expand Down

0 comments on commit 26303a1

Please sign in to comment.