2022-05-25 12:06:35 +03:00
|
|
|
import Component from '@glimmer/component';
|
2022-02-01 12:34:03 +03:00
|
|
|
import {action} from '@ember/object';
|
2019-06-18 13:47:21 +03:00
|
|
|
|
2022-02-01 12:34:03 +03:00
|
|
|
export default class GhCanvasHeader extends Component {
|
|
|
|
@action
|
2022-05-25 12:06:35 +03:00
|
|
|
onScroll(element, scrollContainer) {
|
|
|
|
if (this._isSticky && scrollContainer.scrollTop < 10) {
|
2019-06-18 13:47:21 +03:00
|
|
|
element.classList.remove('gh-canvas-header--sticky');
|
|
|
|
this._isSticky = false;
|
2022-05-25 12:06:35 +03:00
|
|
|
} else if (!this._isSticky && scrollContainer.scrollTop > 10) {
|
2019-06-18 13:47:21 +03:00
|
|
|
element.classList.add('gh-canvas-header--sticky');
|
|
|
|
this._isSticky = true;
|
|
|
|
}
|
|
|
|
}
|
2022-02-01 12:34:03 +03:00
|
|
|
}
|