1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Active tab soft background

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-03-11 18:10:59 +03:00
parent 00121fd044
commit 4ac89429de
2 changed files with 63 additions and 4 deletions

View File

@ -0,0 +1,56 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
.DockTab {
padding: var(--padding);
height: 32px;
margin-top: 3px;
margin-bottom: 3px;
margin-right: 4px;
border-radius: 3px;
position: relative;
background: no-repeat left 50% linear-gradient(0deg, #43424d, #43424d);
background-size: 1px 3ch;
&.pinned {
padding-right: var(--padding);
}
&:last-child {
padding-right: var(--padding);
}
&:global(.active) {
background-color: hsl(245deg 8% 28%);
background-image: none;
.tabIcon {
opacity: 1;
}
}
&::after {
display: none;
}
&:not(:global(.active)):hover {
background-color: #343439;
background-image: none;
.tabIcon {
opacity: 1;
}
}
}
.tabIcon {
opacity: 0;
}
.title {
max-width: 250px;
overflow: hidden;
text-overflow: ellipsis;
}

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import "./dock-tab.scss"; import styles from "./dock-tab.module.css";
import React from "react"; import React from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
@ -76,14 +76,15 @@ class NonInjectedDockTab extends React.Component<DockTabProps & Dependencies> {
} }
render() { render() {
const { className, moreActions, dockStore, ...tabProps } = this.props; const { className, moreActions, dockStore, active, ...tabProps } = this.props;
const { title, pinned } = tabProps.value; const { title, pinned } = tabProps.value;
const label = ( const label = (
<div className="flex gaps align-center" onAuxClick={isMiddleClick(prevDefault(this.close))}> <div className="flex gaps align-center" onAuxClick={isMiddleClick(prevDefault(this.close))}>
<span className="title" title={title}>{title}</span> <span className={styles.title} title={title}>{title}</span>
{moreActions} {moreActions}
{!pinned && ( {!pinned && (
<Icon <Icon
className={styles.tabIcon}
small material="close" small material="close"
tooltip={`Close ${isMac ? "⌘+W" : "Ctrl+W"}`} tooltip={`Close ${isMac ? "⌘+W" : "Ctrl+W"}`}
onClick={prevDefault(this.close)} onClick={prevDefault(this.close)}
@ -97,7 +98,9 @@ class NonInjectedDockTab extends React.Component<DockTabProps & Dependencies> {
<Tab <Tab
{...tabProps} {...tabProps}
id={`tab-${this.tabId}`} id={`tab-${this.tabId}`}
className={cssNames("DockTab", className, { pinned })} className={cssNames(styles.DockTab, className, {
[styles.pinned]: pinned,
})}
onContextMenu={() => this.menuVisible = true} onContextMenu={() => this.menuVisible = true}
label={label} label={label}
/> />