Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions projects/dxc-ngx-cdk/src/lib/dxc-card/dxc-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,7 @@ import {
coerceNumberProperty,
} from "@angular/cdk/coercion";
import { BackgroundProviderService } from "../background-provider/service/background-provider.service";

type Space =
| "xxsmall"
| "xsmall"
| "small"
| "medium"
| "large"
| "xlarge"
| "xxlarge";

type Size = {
top?: Space;
bottom?: Space;
left?: Space;
right?: Space;
};
import { Space, Spacing, CardProperties } from "./dxc-card.types"

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

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

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

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

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

defaultInputs = new BehaviorSubject<any>({
defaultInputs = new BehaviorSubject<CardProperties>({
imageSrc: null,
imageBgColor: "black",
imagePadding: null,
Expand Down
28 changes: 28 additions & 0 deletions projects/dxc-ngx-cdk/src/lib/dxc-card/dxc-card.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export type Space =
| "xxsmall"
| "xsmall"
| "small"
| "medium"
| "large"
| "xlarge"
| "xxlarge";

export type Spacing = {
top?: Space;
bottom?: Space;
left?: Space;
right?: Space;
};

export interface CardProperties {
imageSrc: string;
imageBgColor: string;
imagePadding: Space | Spacing;
imagePosition: "after" | "before";
contentPadding: Space | Spacing;
linkHref: string;
imageCover: boolean;
margin: Space | Spacing;
tabIndexValue: number;
outlined: boolean;
}