mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-03 15:06:01 +03:00
Bugfix tray accordion
This commit is contained in:
parent
abe07c071c
commit
5f3aebd519
@ -1,29 +1,9 @@
|
||||
export function accordion(node: HTMLDivElement, isOpen: boolean) {
|
||||
const initialHeight = node.offsetHeight;
|
||||
node.style.height = isOpen ? 'auto' : '0';
|
||||
node.style.overflow = 'hidden';
|
||||
return {
|
||||
update(isOpenInner: boolean) {
|
||||
const animation = node.animate(
|
||||
[
|
||||
{
|
||||
height: initialHeight + 'px',
|
||||
overflow: 'visible'
|
||||
},
|
||||
{
|
||||
height: 0,
|
||||
overflow: 'hidden'
|
||||
}
|
||||
],
|
||||
{ duration: 100, fill: 'both' }
|
||||
);
|
||||
animation.pause();
|
||||
if (!isOpenInner) {
|
||||
animation.play();
|
||||
} else {
|
||||
animation.reverse();
|
||||
animation.play();
|
||||
}
|
||||
node.style.display = isOpenInner ? 'initial' : 'none';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user