libs/core/ui/src/headline/headline.component.ts

Metadata

Relationships

import { TalyInternalHeadlineComponent } from '../internal-headline/internal-headline.component';
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { ConfiguredSectionDirective } from './configured-section.directive';

@Component({
  selector: 'taly-headline',
  templateUrl: './headline.component.html',
  styleUrl: './headline.component.scss',
  imports: [CommonModule, TalyInternalHeadlineComponent],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class TalyHeadlineComponent {
  protected isInsideSection = Boolean(
    inject(ConfiguredSectionDirective, {
      optional: true,
      skipSelf: true
    })
  );
}
@if (isInsideSection) {
<taly-internal-headline type="subsection" data-testid="subsectionHeadline">
  <ng-container *ngTemplateOutlet="content"></ng-container>
</taly-internal-headline>
} @if (!isInsideSection) {
<taly-internal-headline type="section" data-testid="sectionHeadline">
  <ng-container *ngTemplateOutlet="content"></ng-container>
</taly-internal-headline>
}

<ng-template #content><ng-content></ng-content></ng-template>

./headline.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""