summaryrefslogtreecommitdiff
path: root/src/overlay.js
blob: 78fb579f237b7432046a40a73b91011f47587e6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import config from './config';

export default class Overlay {
  constructor() {
    const overlay = document.createElement('div');
    overlay.id = 'libra-overlay';
    overlay.classList.add('libra-overlay', 'libra-hidden');

    // Set transition duration from config
    overlay.style.transitionDuration = config.transitionDuration + 'ms';

    this.element = overlay;
    document.body.appendChild(overlay);

    return this;
  }

  show() {
    this.element.classList.remove('libra-hidden');
    this.element.classList.add('libra-visible');
  }

  hide() {
    this.element.classList.remove('libra-visible');
    this.element.classList.add('libra-hidden');
  }
}