From 79668e596f6da90530dc695b721a32cd8afcf8cf Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Fri, 25 Mar 2022 17:45:55 +1100 Subject: Add search icon and basic modal --- src/components/SearchModal.vue | 33 +++++++++++++++++++++++++++++++++ src/components/Settings.vue | 2 +- src/components/TileTree.vue | 37 ++++++++++++++++++++++++++++++------- 3 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 src/components/SearchModal.vue diff --git a/src/components/SearchModal.vue b/src/components/SearchModal.vue new file mode 100644 index 0000000..0a2a642 --- /dev/null +++ b/src/components/SearchModal.vue @@ -0,0 +1,33 @@ + + + diff --git a/src/components/Settings.vue b/src/components/Settings.vue index 0c7f360..433be16 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -118,7 +118,7 @@ export default defineComponent({
- diff --git a/src/components/TileTree.vue b/src/components/TileTree.vue index 1c08085..239002b 100644 --- a/src/components/TileTree.vue +++ b/src/components/TileTree.vue @@ -3,6 +3,7 @@ import {defineComponent, PropType} from 'vue'; import Tile from './Tile.vue'; import ParentBar from './ParentBar.vue'; import TileInfoModal from './TileInfoModal.vue'; +import SearchModal from './SearchModal.vue'; import Settings from './Settings.vue'; import {TolNode, LayoutNode, initLayoutTree, tryLayout} from '../lib'; import type {LayoutOptions} from '../lib'; @@ -72,6 +73,7 @@ export default defineComponent({ layoutTree: layoutTree, activeRoot: layoutTree, infoModalNode: null as TolNode | null, // Hides/unhides info modal, and provides the node to display + searchOpen: false, settingsOpen: false, // Options layoutOptions: {...defaultLayoutOptions}, @@ -202,6 +204,7 @@ export default defineComponent({ }, // For info modal events onInnerInfoIconClicked(node: LayoutNode){ + this.closeModalsAndSettings(); this.infoModalNode = node.tolNode; }, onInfoModalClose(){ @@ -209,6 +212,7 @@ export default defineComponent({ }, // onSettingsOpen(){ + this.closeModalsAndSettings(); this.settingsOpen = true; }, onSettingsClose(){ @@ -217,14 +221,23 @@ export default defineComponent({ onLayoutOptionChange(){ tryLayout(this.activeRoot, this.tileAreaPos, this.tileAreaDims, this.layoutOptions, true); }, + // + onSearchIconClick(){ + this.closeModalsAndSettings(); + this.searchOpen = true; + }, + onSearchClose(){ + this.searchOpen = false; + }, + // + closeModalsAndSettings(){ + this.infoModalNode = null; + this.searchOpen = false; + this.settingsOpen = false; + }, onKeyUp(evt: KeyboardEvent){ if (evt.key == 'Escape'){ - if (this.settingsOpen){ - this.settingsOpen = false; - } - if (this.infoModalNode != null){ - this.infoModalNode = null; - } + this.closeModalsAndSettings(); } }, }, @@ -237,7 +250,7 @@ export default defineComponent({ window.removeEventListener('resize', this.onResize); window.removeEventListener('keyup', this.onKeyUp); }, - components: {Tile, ParentBar, TileInfoModal, Settings, }, + components: {Tile, ParentBar, TileInfoModal, Settings, SearchModal, }, }); @@ -255,6 +268,16 @@ export default defineComponent({ + + + + + + + -- cgit v1.2.3