waveterm/frontend/app/tab/tab.scss
2024-12-03 20:56:48 +08:00

137 lines
2.8 KiB
SCSS

// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
.tab {
position: absolute;
width: 130px;
height: calc(100% - 1px);
padding: 6px 0px 0px;
box-sizing: border-box;
font-weight: bold;
color: var(--secondary-text-color);
opacity: 0;
display: flex;
align-items: center;
justify-content: center;
.separator {
position: absolute;
right: 0;
width: 1px;
height: 14px;
border-right-width: 1px;
border-right-style: solid;
border-color: rgb(from var(--main-text-color) r g b / 0.2);
}
.tab-inner {
position: relative;
width: calc(100% - 6px);
height: 100%;
white-space: nowrap;
border-radius: 6px;
}
&:hover {
// & + .tab::after,
// &::after {
// content: none;
// }
.tab-inner {
border-color: transparent;
background: rgb(from var(--main-text-color) r g b / 0.07);
}
}
&.animate {
transition:
transform 0.3s ease,
background-color 0.3s ease-in-out;
}
&.active {
.tab-inner {
border-color: transparent;
border-radius: 6px;
background: rgb(from var(--main-text-color) r g b / 0.07);
}
.name {
color: var(--main-text-color);
}
// &+.tab::after,
// &::after {
// content: none;
// }
}
// &:first-child::after {
// content: none;
// }
.name {
position: absolute;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
user-select: none;
z-index: var(--zindex-tab-name);
font-size: 11px;
font-weight: 500;
text-shadow: 0px 0px 4px rgb(from var(--main-bg-color) r g b / 0.25);
overflow: hidden;
width: calc(100% - 10px);
text-overflow: ellipsis;
text-align: center;
&.focused {
outline: none;
border: 1px solid rgb(from var(--main-text-color) r g b / 0.179);
padding: 2px 6px;
border-radius: 2px;
}
}
.close {
visibility: hidden;
position: absolute;
top: 50%;
right: 4px;
transform: translate3d(0, -50%, 0);
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: var(--zindex-tab-name);
padding: 1px 2px;
}
&:hover .close {
visibility: visible;
backdrop-filter: blur(3px);
&:hover {
color: var(--main-text-color);
}
}
}
@keyframes expandWidthAndFadeIn {
from {
width: var(--initial-tab-width);
opacity: 0;
}
to {
width: var(--final-tab-width);
opacity: 1;
}
}
.tab.new-tab {
animation: expandWidthAndFadeIn 0.1s forwards;
}