From 6afc33e8cde08b196735dd369fd52cee3f27ca1d Mon Sep 17 00:00:00 2001 From: agonzalez97 Date: Tue, 5 Apr 2022 16:37:46 +0200 Subject: [PATCH 1/2] Added types file in tabs --- .../src/lib/dxc-tabs/dxc-tabs.component.ts | 25 ++++--------------- .../src/lib/dxc-tabs/dxc-tabs.types.ts | 21 ++++++++++++++++ 2 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.component.ts b/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.component.ts index f5c5a9635..91af98aa8 100644 --- a/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.component.ts +++ b/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.component.ts @@ -21,6 +21,7 @@ import { MAT_RIPPLE_GLOBAL_OPTIONS, RippleGlobalOptions, } from "@angular/material/core"; +import { TabsProperties, Spacing, Space } from "./dxc-tabs.types"; const globalRippleConfig: RippleGlobalOptions = { animation: { @@ -29,22 +30,6 @@ const globalRippleConfig: RippleGlobalOptions = { }, }; -type Space = - | "xxsmall" - | "xsmall" - | "small" - | "medium" - | "large" - | "xlarge" - | "xxlarge"; - -type Margin = { - top?: Space; - bottom?: Space; - left?: Space; - right?: Space; -}; - @Component({ selector: "dxc-tabs", templateUrl: "./dxc-tabs.component.html", @@ -75,11 +60,11 @@ export class DxcTabsComponent implements OnChanges { /** * 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 + * ('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; @HostBinding("class.label-icons") allTabWithLabelAndIcon: boolean = false; @@ -94,7 +79,7 @@ export class DxcTabsComponent implements OnChanges { @ContentChildren(DxcTabComponent) protected tabs: QueryList; - defaultInputs = new BehaviorSubject({ + defaultInputs = new BehaviorSubject({ activeTabIndex: 0, iconPosition: "left", margin: null, diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts b/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts new file mode 100644 index 000000000..1aeefa0d5 --- /dev/null +++ b/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts @@ -0,0 +1,21 @@ +type Space = + | "xxsmall" + | "xsmall" + | "small" + | "medium" + | "large" + | "xlarge" + | "xxlarge"; + +type Spacing = { + top?: Space; + bottom?: Space; + left?: Space; + right?: Space; +}; + +export interface TabsProperties { + activeTabIndex?: number; + iconPosition: "top" | "left"; + margin?: Space | Spacing; +} From df4bddb54f52785f7744dfc4daec94ead8dd2cf9 Mon Sep 17 00:00:00 2001 From: agonzalez97 Date: Tue, 5 Apr 2022 16:38:49 +0200 Subject: [PATCH 2/2] Update dxc-tabs.types.ts --- projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts b/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts index 1aeefa0d5..82765c554 100644 --- a/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts +++ b/projects/dxc-ngx-cdk/src/lib/dxc-tabs/dxc-tabs.types.ts @@ -1,4 +1,4 @@ -type Space = +export type Space = | "xxsmall" | "xsmall" | "small" @@ -7,7 +7,7 @@ type Space = | "xlarge" | "xxlarge"; -type Spacing = { +export type Spacing = { top?: Space; bottom?: Space; left?: Space; @@ -16,6 +16,6 @@ type Spacing = { export interface TabsProperties { activeTabIndex?: number; - iconPosition: "top" | "left"; + iconPosition?: "top" | "left"; margin?: Space | Spacing; }