mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-05 17:15:19 +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) {
|
export function accordion(node: HTMLDivElement, isOpen: boolean) {
|
||||||
const initialHeight = node.offsetHeight;
|
|
||||||
node.style.height = isOpen ? 'auto' : '0';
|
node.style.height = isOpen ? 'auto' : '0';
|
||||||
node.style.overflow = 'hidden';
|
node.style.overflow = 'hidden';
|
||||||
return {
|
return {
|
||||||
update(isOpenInner: boolean) {
|
update(isOpenInner: boolean) {
|
||||||
const animation = node.animate(
|
node.style.display = isOpenInner ? 'initial' : 'none';
|
||||||
[
|
|
||||||
{
|
|
||||||
height: initialHeight + 'px',
|
|
||||||
overflow: 'visible'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
height: 0,
|
|
||||||
overflow: 'hidden'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
{ duration: 100, fill: 'both' }
|
|
||||||
);
|
|
||||||
animation.pause();
|
|
||||||
if (!isOpenInner) {
|
|
||||||
animation.play();
|
|
||||||
} else {
|
|
||||||
animation.reverse();
|
|
||||||
animation.play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user