about summary refs log tree commit diff
path: root/src/state/models/shell.ts
blob: a2e83b5e3aa711b8b346b2f72892d55976bfae8b (plain) (blame)
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
28
29
30
31
32
33
34
35
36
import {makeAutoObservable} from 'mobx'

export class LinkActionsModel {
  name = 'link-actions'

  constructor(public href: string, public title: string) {
    makeAutoObservable(this)
  }
}

export class SharePostModel {
  name = 'share-post'

  constructor(public href: string) {
    makeAutoObservable(this)
  }
}

export class ShellModel {
  isModalActive = false
  activeModal: LinkActionsModel | SharePostModel | undefined

  constructor() {
    makeAutoObservable(this)
  }

  openModal(modal: LinkActionsModel | SharePostModel) {
    this.isModalActive = true
    this.activeModal = modal
  }

  closeModal() {
    this.isModalActive = false
    this.activeModal = undefined
  }
}