Add new tab animation

This commit is contained in:
Paul Frazee 2022-11-17 15:44:54 -06:00
parent 2b98714548
commit b2160ae159
3 changed files with 51 additions and 14 deletions

View file

@ -16,6 +16,7 @@ export class NavigationTabModel {
id = genTabId()
history: HistoryItem[] = [{url: '/', ts: Date.now()}]
index = 0
isNewTab = false
constructor() {
makeAutoObservable(this, {
@ -112,6 +113,10 @@ export class NavigationTabModel {
this.current.title = title
}
setIsNewTab(v: boolean) {
this.isNewTab = v
}
// persistence
// =
@ -208,6 +213,7 @@ export class NavigationModel {
newTab(url: string, title?: string) {
const tab = new NavigationTabModel()
tab.navigate(url, title)
tab.isNewTab = true
this.tabs.push(tab)
this.tabIndex = this.tabs.length - 1
}