Skip to content

Commit 50cc7ec

Browse files
committed
adding type file for card component
1 parent b8384ed commit 50cc7ec

File tree

2 files changed

+33
-20
lines changed

2 files changed

+33
-20
lines changed

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

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,7 @@ import {
1919
coerceNumberProperty,
2020
} from "@angular/cdk/coercion";
2121
import { BackgroundProviderService } from "../background-provider/service/background-provider.service";
22-
23-
type Space =
24-
| "xxsmall"
25-
| "xsmall"
26-
| "small"
27-
| "medium"
28-
| "large"
29-
| "xlarge"
30-
| "xxlarge";
31-
32-
type Size = {
33-
top?: Space;
34-
bottom?: Space;
35-
left?: Space;
36-
right?: Space;
37-
};
22+
import { Space, Spacing, CardProperties } from "./dxc-card.types"
3823

3924
@Component({
4025
selector: "dxc-card",
@@ -59,7 +44,7 @@ export class DxcCardComponent implements OnInit {
5944
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties
6045
* in order to specify different padding sizes.
6146
*/
62-
@Input() imagePadding: Space | Size;
47+
@Input() imagePadding: Space | Spacing;
6348

6449
/**
6550
* Whether the image should appear in relation to the content.
@@ -72,7 +57,7 @@ export class DxcCardComponent implements OnInit {
7257
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties
7358
* in order to specify different padding sizes.
7459
*/
75-
@Input() contentPadding: Space | Size;
60+
@Input() contentPadding: Space | Spacing;
7661

7762
/**
7863
* If defined, the card will be displayed as an anchor, using this prop as "href".
@@ -104,7 +89,7 @@ export class DxcCardComponent implements OnInit {
10489
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
10590
* order to specify different margin sizes.
10691
*/
107-
@Input() margin: Space | Size;
92+
@Input() margin: Space | Spacing;
10893

10994
/**
11095
* Value of the tabindex given when there is an href.
@@ -129,7 +114,7 @@ export class DxcCardComponent implements OnInit {
129114

130115
@ViewChild("content", { static: false }) content: ElementRef;
131116

132-
defaultInputs = new BehaviorSubject<any>({
117+
defaultInputs = new BehaviorSubject<CardProperties>({
133118
imageSrc: null,
134119
imageBgColor: "black",
135120
imagePadding: null,
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export type Space =
2+
| "xxsmall"
3+
| "xsmall"
4+
| "small"
5+
| "medium"
6+
| "large"
7+
| "xlarge"
8+
| "xxlarge";
9+
10+
export type Spacing = {
11+
top?: Space;
12+
bottom?: Space;
13+
left?: Space;
14+
right?: Space;
15+
};
16+
17+
export interface CardProperties {
18+
imageSrc: string;
19+
imageBgColor: string;
20+
imagePadding: Space | Spacing;
21+
imagePosition: "after" | "before";
22+
contentPadding: Space | Spacing;
23+
linkHref: string;
24+
imageCover: boolean;
25+
margin: Space | Spacing;
26+
tabIndexValue: number;
27+
outlined: boolean;
28+
}

0 commit comments

Comments
 (0)