Skip to content

Commit 5ca9bfe

Browse files
authored
Merge pull request #791 from dxc-technology/heading-types-interface
Added types file in heading
2 parents 814d0a6 + e460df4 commit 5ca9bfe

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

projects/dxc-ngx-cdk/src/lib/dxc-heading/dxc-heading.component.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,7 @@ import { css } from "emotion";
22
import { CssUtils } from "../utils";
33
import { BehaviorSubject } from "rxjs";
44
import { Component, Input, HostBinding, SimpleChanges } from "@angular/core";
5-
6-
type Space =
7-
| "xxsmall"
8-
| "xsmall"
9-
| "small"
10-
| "medium"
11-
| "large"
12-
| "xlarge"
13-
| "xxlarge";
14-
15-
type Margin = {
16-
top?: Space;
17-
bottom?: Space;
18-
left?: Space;
19-
right?: Space;
20-
};
5+
import { HeadingProperties, Space, Spacing } from "./dxc-heading.types";
216

227
@Component({
238
selector: "dxc-heading",
@@ -45,11 +30,11 @@ export class DxcHeadingComponent {
4530
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
4631
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
4732
*/
48-
@Input() margin: Space | Margin;
33+
@Input() margin: Space | Spacing;
4934

5035
@HostBinding("class") className;
5136

52-
defaultInputs = new BehaviorSubject<any>({
37+
defaultInputs = new BehaviorSubject<HeadingProperties>({
5338
level: 1,
5439
asTag: null,
5540
text: null,
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export interface HeadingProperties {
2+
margin?: Space | Spacing;
3+
level?: 1 | 2 | 3 | 4 | 5;
4+
asTag?: "h1" | "h2" | "h3" | "h4" | "h5";
5+
text: string;
6+
weight?: "light" | "normal" | "bold";
7+
}
8+
9+
export type Space =
10+
| "xxsmall"
11+
| "xsmall"
12+
| "small"
13+
| "medium"
14+
| "large"
15+
| "xlarge"
16+
| "xxlarge";
17+
18+
export type Spacing = {
19+
top?: Space;
20+
bottom?: Space;
21+
left?: Space;
22+
right?: Space;
23+
};

0 commit comments

Comments
 (0)