From ca8f61bf02dbf43582ebb4fe0052fe6abc011b52 Mon Sep 17 00:00:00 2001 From: Vicki League Date: Wed, 25 Jun 2025 12:48:52 -0400 Subject: [PATCH] finish migrating typography --- .../src/typography/typography.directive.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/libs/components/src/typography/typography.directive.ts b/libs/components/src/typography/typography.directive.ts index b261995b442..3605a1ff7f7 100644 --- a/libs/components/src/typography/typography.directive.ts +++ b/libs/components/src/typography/typography.directive.ts @@ -1,7 +1,6 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import { coerceBooleanProperty } from "@angular/cdk/coercion"; -import { Directive, HostBinding, Input, input } from "@angular/core"; +import { booleanAttribute, Directive, HostBinding, input } from "@angular/core"; type TypographyType = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "helper"; @@ -35,15 +34,11 @@ const margins: Record = { export class TypographyDirective { readonly bitTypography = input(undefined); - private _margin = true; - // TODO: Skipped for migration because: - // Accessor inputs cannot be migrated as they are too complex. - @Input() - set noMargin(value: boolean | "") { - this._margin = !coerceBooleanProperty(value); - } + noMargin = input(false, { transform: booleanAttribute }); @HostBinding("class") get classList() { - return styles[this.bitTypography()].concat(this._margin ? margins[this.bitTypography()] : []); + return styles[this.bitTypography()].concat( + !this.noMargin() ? margins[this.bitTypography()] : [], + ); } }