File

libs/common/frame/src/frame-parts/offer-code/offer-code.component.ts

Implements

OnInit

Metadata

Index

Properties
Inputs
HostBindings
Accessors

Inputs

hasFooter
Type : boolean
Default value : false
hasSmallPrint
Type : boolean
Default value : false
offerCode$
Type : Observable<string | undefined>

HostBindings

class.no-spacing
Type : boolean

Properties

hasMargin
Default value : !inject(NO_MARGIN)
pageId$
Type : Observable<string>

Accessors

shouldRemoveSpacing
getshouldRemoveSpacing()
import { NO_MARGIN, TalyPageDataService } from '@allianz/taly-core';
import { Component, HostBinding, Input, OnInit, inject } from '@angular/core';
import { Observable } from 'rxjs';

@Component({
  selector: 'frame-offer-code',
  templateUrl: './offer-code.component.html',
  styleUrls: ['./offer-code.component.scss'],
  standalone: false
})
export class OfferCodeComponent implements OnInit {
  private readonly talyPageDataService = inject(TalyPageDataService);

  @Input() offerCode$!: Observable<string | undefined>;
  @Input() hasFooter = false;
  @Input() hasSmallPrint = false;
  pageId$!: Observable<string>;

  hasMargin = !inject(NO_MARGIN);

  @HostBinding('class.no-spacing')
  get shouldRemoveSpacing() {
    return !this.hasSmallPrint && !this.hasFooter && !this.hasMargin;
  }

  ngOnInit(): void {
    this.pageId$ = this.talyPageDataService.pageId$;
  }
}
<p
  nxCopytext
  data-testid="offerCode"
  class="offer-code"
  [class.has-margin]="hasMargin"
  *aclTag="(pageId$ | async) + '/offer-code'"
>
  <span class="nx-font-weight-semibold" i18n="@@frame.offer-code">Your proposal code is:</span>
  {{ offerCode$ | async }}
</p>

./offer-code.component.scss

@use '../../../styles/breakpoints.scss' as *;
@use '../../../styles/spacing.scss' as *;

:host {
  display: flex;
  justify-content: center;
}

.offer-code {
  text-align: center;
  margin-bottom: var(--vertical-outer-section-spacing);
  max-width: 100%;
  width: var(--grid-max-width);
  margin-left: auto;
  margin-right: auto;
}

:host(.no-spacing) .offer-code:not(.has-margin) {
  margin-bottom: 0px;
  padding: 0;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""