From a6c0430e1e66af768596253c4500cf4ee5c2a42f Mon Sep 17 00:00:00 2001 From: agonzalez97 Date: Wed, 6 Apr 2022 16:00:32 +0200 Subject: [PATCH] Added types file in footer --- .../lib/dxc-footer/dxc-footer.component.ts | 33 +++++-------------- .../src/lib/dxc-footer/dxc-footer.types.ts | 25 ++++++++++++++ 2 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 projects/dxc-ngx-cdk/src/lib/dxc-footer/dxc-footer.types.ts diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-footer/dxc-footer.component.ts b/projects/dxc-ngx-cdk/src/lib/dxc-footer/dxc-footer.component.ts index 1477c55ad..2b95acf61 100644 --- a/projects/dxc-ngx-cdk/src/lib/dxc-footer/dxc-footer.component.ts +++ b/projects/dxc-ngx-cdk/src/lib/dxc-footer/dxc-footer.component.ts @@ -12,27 +12,7 @@ import { CssUtils } from "../utils"; import { responsiveSizes } from "../variables"; 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 Margin = { - top?: Space; - bottom?: Space; - left?: Space; - right?: Space; -}; - -export interface DxcFooterInputs { - margin: Space | Margin; - padding: Space | Margin; -} +import { FooterProperties, Space, Spacing } from "./dxc-footer.types"; @Component({ selector: "dxc-footer", @@ -69,14 +49,14 @@ export class DxcFooterComponent implements OnChanges { * 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; /** * Size of the padding to be applied to the custom area of 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 padding sizes. */ - @Input() padding: Space | Margin; + @Input() padding: Space | Spacing; /** * The path of an icon to replace the theme logo. */ @@ -100,9 +80,14 @@ export class DxcFooterComponent implements OnChanges { bottomLinksLength: number; currentBackgroundColor: string; - defaultInputs = new BehaviorSubject({ + defaultInputs = new BehaviorSubject({ margin: null, padding: null, + socialLinks: [], + bottomLinks: [], + copyright: "© DXC Technology 2022. All rights reserved.", + logoSrc: null, + tabIndexValue: 0, }); @HostListener("window:resize", ["$event"]) diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-footer/dxc-footer.types.ts b/projects/dxc-ngx-cdk/src/lib/dxc-footer/dxc-footer.types.ts new file mode 100644 index 000000000..851991923 --- /dev/null +++ b/projects/dxc-ngx-cdk/src/lib/dxc-footer/dxc-footer.types.ts @@ -0,0 +1,25 @@ +export interface FooterProperties { + margin?: Space | Spacing; + socialLinks?: { href?: string; logoSrc?: string }[]; + bottomLinks?: { href?: string; text?: string }[]; + copyright?: string; + padding?: Space | Spacing; + logoSrc: string; + tabIndexValue: number; +} + +export type Space = + | "xxsmall" + | "xsmall" + | "small" + | "medium" + | "large" + | "xlarge" + | "xxlarge"; + +export type Spacing = { + top?: Space; + bottom?: Space; + left?: Space; + right?: Space; +};