diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-heading/dxc-heading.component.ts b/projects/dxc-ngx-cdk/src/lib/dxc-heading/dxc-heading.component.ts index e55b3c127..249ff414d 100644 --- a/projects/dxc-ngx-cdk/src/lib/dxc-heading/dxc-heading.component.ts +++ b/projects/dxc-ngx-cdk/src/lib/dxc-heading/dxc-heading.component.ts @@ -2,22 +2,7 @@ import { css } from "emotion"; import { CssUtils } from "../utils"; import { BehaviorSubject } from "rxjs"; import { Component, Input, HostBinding, SimpleChanges } from "@angular/core"; - -type Space = - | "xxsmall" - | "xsmall" - | "small" - | "medium" - | "large" - | "xlarge" - | "xxlarge"; - -type Margin = { - top?: Space; - bottom?: Space; - left?: Space; - right?: Space; -}; +import { HeadingProperties, Space, Spacing } from "./dxc-heading.types"; @Component({ selector: "dxc-heading", @@ -45,11 +30,11 @@ export class DxcHeadingComponent { * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'). * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes. */ - @Input() margin: Space | Margin; + @Input() margin: Space | Spacing; @HostBinding("class") className; - defaultInputs = new BehaviorSubject({ + defaultInputs = new BehaviorSubject({ level: 1, asTag: null, text: null, diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-heading/dxc-heading.types.ts b/projects/dxc-ngx-cdk/src/lib/dxc-heading/dxc-heading.types.ts new file mode 100644 index 000000000..4338e9e5c --- /dev/null +++ b/projects/dxc-ngx-cdk/src/lib/dxc-heading/dxc-heading.types.ts @@ -0,0 +1,23 @@ +export interface HeadingProperties { + margin?: Space | Spacing; + level?: 1 | 2 | 3 | 4 | 5; + asTag?: "h1" | "h2" | "h3" | "h4" | "h5"; + text: string; + weight?: "light" | "normal" | "bold"; +} + +export type Space = + | "xxsmall" + | "xsmall" + | "small" + | "medium" + | "large" + | "xlarge" + | "xxlarge"; + +export type Spacing = { + top?: Space; + bottom?: Space; + left?: Space; + right?: Space; +};