From 6c89011de7a2d06ce03baa7d60442474b09fb652 Mon Sep 17 00:00:00 2001 From: AlphaX-Projects <77661270+AlphaX-Projects@users.noreply.github.com> Date: Sun, 18 Jun 2023 11:32:16 +0200 Subject: [PATCH] Rework tabs Thanks to PigPig105 for the hide close button. --- core/src/components/show-plugin.js | 110 ++++++++++++++++------------- 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/core/src/components/show-plugin.js b/core/src/components/show-plugin.js index dfb53ce2..5f45dcd6 100644 --- a/core/src/components/show-plugin.js +++ b/core/src/components/show-plugin.js @@ -103,15 +103,27 @@ class ShowPlugin extends connect(store)(LitElement) { min-width: 50px; max-width: 200px; overflow: hidden; - text-wrap: nowrap; - text-overflow: ellipsis; zIndex: 2; } + .tabCard { + display: inline-block; + } + + .tabTitle { + display: inline-block; + position: relative; + width: auto; + min-width: 25px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + .tab:hover { background: var(--nav-color-hover); - color: #03a9f4; - font-weight: bold; + color: var(--black); + min-width: fit-content; } .tab.active { @@ -131,17 +143,39 @@ class ShowPlugin extends connect(store)(LitElement) { } .close { - color: #999; + position: absolute; + top: 8px; + right: 5px; + color: var(--black); + --mdc-icon-size: 20px; + } + + .close:hover { + color: #C6011F; font-weight: bold; - font-size: 16px; } - .title { + .tab .close, + .tab .show { + display: none; + } + + .tab.active .close, + .tab.active .show { display: inline-block; + color: var(--black); } - .close:hover { - color: red; + .tab:hover .close, + .tab:hover .show { + display: inline-block; + color: var(--black); + } + + .tab .close:hover, + .tab.active .close:hover { + color: #C6011F; + font-weight: bold; } .add-tab-button { @@ -173,6 +207,10 @@ class ShowPlugin extends connect(store)(LitElement) { --mdc-icon-size: 24px; } + .tab:hover .iconInactive { + color: #03a9f4; + } + .count { font-weight: bold; background-color: #C6011F; @@ -209,40 +247,12 @@ class ShowPlugin extends connect(store)(LitElement) { margin-left: 30px; } - .mr-10 { - margin-right: 10px; - } - - .mr-15 { - margin-right: 15px; - } - - .mr-20 { - margin-right: 20px; - } - - .mt-10 { - margin-top: 10px; - } - - .mt-15 { - margin-top: 15px; - } - - .mt-20 { - margin-top: 20px; - } - - .mb-10 { - margin-bottom: 10px; - } - - .mb-15 { - margin-bottom: 15px; + .ml-35 { + margin-left: 35px; } - .mb-20 { - margin-bottom: 20px; + .ml-40 { + margin-left: 40px; } @keyframes pulse { @@ -359,21 +369,21 @@ class ShowPlugin extends connect(store)(LitElement) {
${icon}
-
+
${count ? html` - ${title} + ${title} ${count} - {this.removeTab(index, tab.id)}}>X + {this.removeTab(index, tab.id)}}>close ` : html` - ${title} - {this.removeTab(index, tab.id)}}>X + ${title} + {this.removeTab(index, tab.id)}}>close `}
` })} + >+ ${repeat(this.tabs, (tab) => tab.id, (tab, index) => html` @@ -1010,4 +1018,4 @@ class NavBar extends connect(store)(LitElement) { } } -customElements.define('nav-bar', NavBar) \ No newline at end of file +customElements.define('nav-bar', NavBar)