Skip to content
Open
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
7 changes: 4 additions & 3 deletions src/components/accordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class AtAccordion extends AtComponent<
this.isCompleted = true
this.startOpen = false
this.state = {
wrapperHeight: 0
wrapperHeight: 'unset'
}
}

Expand Down Expand Up @@ -109,8 +109,9 @@ export default class AtAccordion extends AtComponent<
color: (icon && icon.color) || '',
fontSize: (icon && `${icon.size}px`) || ''
}
const contentStyle = { height: `${wrapperHeight}px` }

const contentStyle = {
height: wrapperHeight === 'unset' ? wrapperHeight : `${wrapperHeight}px`
}
if (this.isCompleted) {
contentStyle.height = ''
}
Expand Down
2 changes: 1 addition & 1 deletion types/accordion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface AtAccordionProps extends AtComponent {
}

export interface AtAccordionState {
wrapperHeight: number
wrapperHeight: number | 'unset'
}

declare const AtAccordion: ComponentClass<AtAccordionProps>
Expand Down