Skip to content

Commit 781a952

Browse files
committed
refactor(accordion-list): remove unused code
1 parent 7c5578a commit 781a952

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/components/accordion-list/accordion-list.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,20 @@ export class AccordionListComponent {
1010
@Input() contentColor: string = '#F9F9F9';
1111
@Input() title: string;
1212
@Input() hasMargin: boolean = true;
13-
@Input() initialState: string;
14-
@Input () expanded: boolean;
13+
@Input() expanded: boolean;
1514

1615
@ViewChild('accordionContent') elementView: ElementRef;
1716

1817
viewHeight: number;
1918

2019
constructor(public renderer: Renderer) { }
21-
20+
2221
ngAfterViewInit() {
23-
this.handleInitialState();
2422
this.viewHeight = this.elementView.nativeElement.offsetHeight;
25-
console.log(this.expanded);
26-
if(!this.expanded)
23+
24+
if (!this.expanded) {
2725
this.renderer.setElementStyle(this.elementView.nativeElement, 'height', 0 + 'px');
26+
}
2827
}
2928

3029
toggleAccordion() {
@@ -33,8 +32,4 @@ export class AccordionListComponent {
3332
this.renderer.setElementStyle(this.elementView.nativeElement, 'height', newHeight);
3433
}
3534

36-
handleInitialState(){
37-
this.expanded = this.initialState === 'expanded'
38-
}
39-
4035
}

src/pages/accordion-list/accordion-list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
<ion-content padding>
1111
<p>Accordion list example - Best places to visit:</p>
1212

13-
<accordion-list *ngFor="let item of items"
13+
<accordion-list *ngFor="let item of items; let index = index"
1414
[title]="item.name"
1515
textColor="#FFF"
1616
hasMargin="false"
1717
headerColor="#F53D3D"
18-
initialState="expanded">
18+
[expanded]="index === 0">
1919
<img [src]="item.imageUrl">
2020
<p text-wrap>{{item.description}}</p>
2121
</accordion-list>

0 commit comments

Comments
 (0)