Skip to content

Commit

Permalink
Merge pull request #772 from dxc-technology/jialecl-accordionTypes
Browse files Browse the repository at this point in the history
Adding type file to accordion
  • Loading branch information
aidamag authored Apr 5, 2022
2 parents 5eca244 + ecb6eb1 commit 973015b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,8 @@ import {
import { DxcAccordionIconComponent } from "./dxc-accordion-icon/dxc-accordion-icon.component";
import { QueryList, ChangeDetectorRef, ElementRef } from "@angular/core";
import { BackgroundProviderComponent } from "../background-provider/background-provider.component";
import { AccordionProperties, Space, Spacing } from "./dxc-accordion.types";

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

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

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

@Component({
selector: "dxc-accordion",
Expand Down Expand Up @@ -84,12 +63,12 @@ export class DxcAccordionComponent implements OnInit, OnChanges, AfterViewInit {
* 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 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 ('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 | Padding;
@Input() padding: Space | Spacing;
/**
* Represents the state of the panel. When true, the component will be
* expanded. If undefined, the component will be uncontrolled and its
Expand Down Expand Up @@ -126,7 +105,10 @@ export class DxcAccordionComponent implements OnInit, OnChanges, AfterViewInit {
@ContentChildren(DxcAccordionIconComponent)
dxcAccordionIcon: QueryList<DxcAccordionIconComponent>;

defaultInputs = new BehaviorSubject<any>({
defaultInputs = new BehaviorSubject<AccordionProperties>({
label: "",
assistiveText: "",
isExpanded: false,
margin: null,
padding: null,
disabled: false,
Expand Down
25 changes: 25 additions & 0 deletions projects/dxc-ngx-cdk/src/lib/dxc-accordion/dxc-accordion.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export type Space =
| "xxsmall"
| "xsmall"
| "small"
| "medium"
| "large"
| "xlarge"
| "xxlarge";

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

export interface AccordionProperties {
label: string;
assistiveText?: string;
disabled: boolean;
isExpanded: boolean;
margin?: Space | Spacing;
padding?: Space | Spacing;
tabIndexValue?: number;
}

0 comments on commit 973015b

Please sign in to comment.