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

[FEATURE] Kuwait Theme - Completion Pop up variant #2642

Merged
merged 8 commits into from
Dec 20, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class="popup-backdrop"
(click)="dismissOnBackdrop($event)"
[attr.data-fullscreen]="props.fullscreen ? true : null"
[attr.data-variant]="props.variant ? props.variant : null"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit(non-blocking) This could be simplified to props.variant || null

>
<div class="popup-container">
<div (click)="dismiss()" class="close-button" fill="clear" *ngIf="props.showCloseButton">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ export interface ITemplatePopupComponentProps extends IContainerProps {
fullscreen?: boolean;
/** Pass text only to render that text in a popup, bypassing any templates */
popupText?: string;
/** Template Parameter: "variant". Defines style and use of pop up */
variant?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@ export class TemplateNavService extends SyncServiceBase {
container?: TemplateContainerComponent
) {
const templatename = action.args[0];
const variant = action.params?.variant;
// if triggered outside templating system (e.g. via notification action) still enable
// popup creation and dismiss on nav changes
if (!container) {
this.router.events.pipe(first()).subscribe(() => this.dismissPopup(templatename));
return this.createPopupAndWaitForDismiss(templatename, null);
return this.createPopupAndWaitForDismiss(templatename, null, variant);
}

const { name } = container;
Expand All @@ -226,6 +227,7 @@ export class TemplateNavService extends SyncServiceBase {
popup_child: templatename,
popup_parent: name,
popup_parent_triggered_by: action._triggeredBy?.name || null,
popup_variant: variant,
};
this.router.navigate([], { queryParams, replaceUrl: true, queryParamsHandling: "merge" });
}
Expand All @@ -234,7 +236,7 @@ export class TemplateNavService extends SyncServiceBase {
params: INavQueryParams,
container: TemplateContainerComponent
) {
const { popup_child, nav_child_emit, popup_parent_triggered_by } = params;
const { popup_child, nav_child_emit, popup_parent_triggered_by, popup_variant } = params;
const { template } = container;
const existingPopup = this.openPopupsByName[popup_child];
log("[Popup] - parent", { params, parent: container.name });
Expand Down Expand Up @@ -274,15 +276,16 @@ export class TemplateNavService extends SyncServiceBase {
}
// If no popup already exists, create, present, and react to dismiss
else {
await this.createPopupAndWaitForDismiss(popup_child, container);
await this.createPopupAndWaitForDismiss(popup_child, container, popup_variant);
}
}

private async createPopupAndWaitForDismiss(
popup_child: string,
container: TemplateContainerComponent
container: TemplateContainerComponent,
variant: string
) {
const childTemplateModal = await this.createChildPopupModal(popup_child, container);
const childTemplateModal = await this.createChildPopupModal(popup_child, container, variant);
if (childTemplateModal) {
await childTemplateModal.present();
const { data } = await childTemplateModal.onDidDismiss();
Expand All @@ -296,6 +299,7 @@ export class TemplateNavService extends SyncServiceBase {
popup_child: null,
popup_parent: null,
popup_parent_triggered_by: null,
popup_variant: null,
};
this.router.navigate([], { queryParams, replaceUrl: true, queryParamsHandling: "merge" });
}
Expand All @@ -314,23 +318,28 @@ export class TemplateNavService extends SyncServiceBase {
container: TemplateContainerComponent
) {
// Hide any open popup that was trigggered on a previous page prior to navigation (unless new popup)
const { popup_child } = params;
const { popup_child, popup_variant } = params;
const existingPopup = this.openPopupsByName[popup_child];
if (existingPopup) {
existingPopup.modal.classList.add("hide-popup-on-template");
} else {
this.createPopupAndWaitForDismiss(params.popup_child, container);
this.createPopupAndWaitForDismiss(params.popup_child, container, popup_variant);
}
}

private async createChildPopupModal(popup_child: string, container: TemplateContainerComponent) {
private async createChildPopupModal(
popup_child: string,
container: TemplateContainerComponent,
variant?: string
) {
const childContainerProps: ITemplatePopupComponentProps = {
// make the popup share the same name as the container so that nav events return to parent container page
name: popup_child,
templatename: popup_child,
parent: container,
showCloseButton: true,
dismissOnEmit: true,
variant,
};
// If trying to recreate a popup that already exists simply mark as visible
const existingPopup = this.openPopupsByName[popup_child];
Expand Down Expand Up @@ -384,4 +393,5 @@ export interface INavQueryParams {
popup_child?: string; //
popup_parent?: string;
popup_parent_triggered_by?: string; //
popup_variant?: string;
}
48 changes: 48 additions & 0 deletions src/theme/themes/plh_kids_kw/_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -974,4 +974,52 @@ body[data-theme="plh_kids_kw"] {
}
}
}

// Pop Up
.popup-backdrop {
&[data-variant~="plh_completion"] {
.popup-container {
min-height: 70vh;
padding: 0 1.4rem;
margin-top: -28px;
.popup-content {
background: linear-gradient(
310deg,
var(--color-secondary-blue-50),
var(--color-secondary-blue-80)
);
border-radius: 40px;
border: none !important;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
}
plh-template-container {
display: flex;
align-items: center;
justify-content: center;
font-family: var(--ion-font-family);
}
plh-tmpl-text p,
plh-tmpl-text h1,
plh-tmpl-title p,
plh-tmpl-title h1 {
text-align: center;
color: var(--color-surface-white);
}
plh-tmpl-title {
div.title-wrapper {
align-items: center;
justify-content: center;
}
}
.close-button {
border: 0.8px solid var(--color-secondary-blue-80);
color: var(--color-secondary-blue-50);
}
}
}
}
}
Loading