From b18bc3ff50671e7109bde3d1eabb8276d313863e Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Thu, 24 Mar 2022 01:10:37 +1100 Subject: Add info icon --- src/components/TileImg.vue | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src/components/TileImg.vue') diff --git a/src/components/TileImg.vue b/src/components/TileImg.vue index be6704c..5a3a2f8 100644 --- a/src/components/TileImg.vue +++ b/src/components/TileImg.vue @@ -11,6 +11,7 @@ export default defineComponent({ data(){ return { highlight: false, + infoMouseOver: false, }; }, computed: { @@ -19,15 +20,20 @@ export default defineComponent({ }, styles(): Record { return { - border: '1px black solid', + // Sizing width: this.tileSz + 'px', height: this.tileSz + 'px', minWidth: this.tileSz + 'px', minHeight: this.tileSz + 'px', + // Image backgroundImage: - 'linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0) 40%),' + + 'linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.4) 100%),' + 'url(\'/img/' + this.layoutNode.tolNode.name.replaceAll('\'', '\\\'') + '.png\')', backgroundSize: 'cover', + // Child layout + display: 'flex', + flexDirection: 'column', + // Other borderRadius: this.options.borderRadius + 'px', boxShadow: this.highlight ? this.options.shadowHighlight : this.options.shadowNormal, }; @@ -45,6 +51,17 @@ export default defineComponent({ whiteSpace: 'nowrap', }; }, + infoIconStyles(): Record { + return { + width: this.options.infoIconSz + 'px', + height: this.options.infoIconSz + 'px', + marginTop: 'auto', + marginBottom: this.options.infoIconPadding + 'px', + marginRight: this.options.infoIconPadding + 'px', + alignSelf: 'flex-end', + color: this.infoMouseOver ? this.options.infoIconHoverColor : this.options.infoIconColor, + }; + }, }, methods: { onMouseEnter(evt: Event){ @@ -54,13 +71,23 @@ export default defineComponent({ }, onMouseLeave(evt: Event){ if (this.isExpandable){ - this.highlight = false; } + this.highlight = false; + } }, onClick(evt: Event){ if (this.isExpandable){ this.highlight = false; } }, + onInfoMouseEnter(evt: Event){ + this.infoMouseOver = true; + }, + onInfoMouseLeave(evt: Event){ + this.infoMouseOver = false; + }, + onInfoClick(evt: Event){ + console.log('Clicked on info icon: ' + this.layoutNode.tolNode.name); + }, }, }); @@ -69,5 +96,13 @@ export default defineComponent({

{{layoutNode.tolNode.name}}

+ + + + +
-- cgit v1.2.3