new tabs design 2 (#100)

This commit is contained in:
Red J Adaya 2024-07-09 06:02:52 +08:00 committed by GitHub
parent 186ca686e3
commit 0cb9b8940b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 39 additions and 82 deletions

View File

@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
.tab { .tab {
position: absolute;
width: 130px; width: 130px;
height: 100%; height: 100%;
position: absolute; padding: 6px 3px;
box-sizing: border-box; box-sizing: border-box;
font-weight: bold; font-weight: bold;
color: var(--secondary-text-color); color: var(--secondary-text-color);
padding: 4px 3px;
.tab-inner { .tab-inner {
position: relative; position: relative;
@ -16,7 +16,7 @@
height: 100%; height: 100%;
white-space: nowrap; white-space: nowrap;
border-radius: 6px; border-radius: 6px;
background: rgba(255, 255, 255, 0.05); background: rgba(35, 35, 35, 0.8);
} }
&.animate { &.animate {
@ -26,12 +26,36 @@
} }
&.active { &.active {
.base-bg {
background: rgba(0, 0, 0, 0.6);
position: absolute;
top: 6px;
left: 3px;
right: 3px;
bottom: 6px;
}
.tab-inner { .tab-inner {
background: radial-gradient( background: radial-gradient(ellipse at top, rgba(118, 255, 53, 0.1) 0%, transparent 120%),
133.33% 73.57% at 50% 100%, radial-gradient(ellipse at bottom, rgba(117, 255, 53, 0.135) 0%, transparent 90%);
rgba(118, 255, 53, 0.3) 0%, }
rgba(255, 255, 255, 0.1) 100%
.mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(
to bottom,
rgb(57, 56, 56) 25%,
rgba(255, 255, 255, 0.201) 90%,
rgba(255, 255, 255, 0.215) 100%
); );
opacity: 0.95;
border-radius: 5px;
z-index: 2;
pointer-events: none;
} }
} }
@ -43,88 +67,37 @@
user-select: none; user-select: none;
z-index: 3; z-index: 3;
font-size: 11px; font-size: 11px;
font-style: normal;
font-weight: 500; font-weight: 500;
&.focused { &.focused {
outline: none; outline: none;
border: 1px solid var(--border-color); border: 1px solid rgba(255, 255, 255, 0.179);
padding: 2px 6px; padding: 2px 6px;
border-radius: 2px; border-radius: 2px;
} }
} }
.vertical-line {
display: inline;
width: 1px;
height: 50%;
position: absolute;
right: -1px;
top: 50%;
z-index: 1;
transform: translateY(-50%);
background-color: var(--border-color);
}
.vertical-line.first {
left: 0;
}
.close { .close {
visibility: hidden; visibility: hidden;
position: absolute; position: absolute;
top: 50%;
right: 0px;
transform: translateY(-50%);
width: 20px; width: 20px;
height: 20px; height: 20px;
padding: 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
top: 50%;
z-index: 3;
transform: translateY(-50%);
right: 5px;
opacity: 0.5; opacity: 0.5;
z-index: 3;
&:hover { &:hover {
opacity: 1; opacity: 1;
cursor: pointer;
}
i {
color: var(--secondary-text-color);
} }
} }
&.active:hover .close { &.active:hover .close {
visibility: visible; visibility: visible;
} }
&.active {
.vertical-line {
visibility: hidden;
}
}
// &.active {
// .mask {
// position: absolute;
// height: 100%;
// width: 100%;
// top: 0;
// left: 0;
// z-index: 2;
// background-image: linear-gradient(
// to top,
// rgba(0, 0, 0, 0.9) 20%,
// rgba(0, 0, 0, 0.8) 60%,
// rgba(0, 0, 0, 0.7) 100%
// );
// pointer-events: none;
// }
// }
&.isDragging:not(.active) {
// background-color: rgba(0, 8, 3, 1);
}
} }

View File

@ -127,23 +127,7 @@ const Tab = React.memo(
onContextMenu={handleContextMenu} onContextMenu={handleContextMenu}
data-tab-id={id} data-tab-id={id}
> >
{/* {isFirst && <div className="vertical-line first" />} {active && <div className="base-bg" />}
<div
ref={editableRef}
className={clsx("name", { focused: isEditable })}
contentEditable={isEditable}
onDoubleClick={handleDoubleClick}
onBlur={handleBlur}
onKeyDown={handleKeyDown}
suppressContentEditableWarning={true}
>
{tabData?.name}
</div>
{!isDragging && <div className="vertical-line" />}
{active && <div className="mask" />}
<Button className="secondary ghost close" onClick={onClose} onMouseDown={handleMouseDownOnClose}>
<i className="fa fa-solid fa-xmark" />
</Button> */}
<div className="tab-inner"> <div className="tab-inner">
<div <div
ref={editableRef} ref={editableRef}

View File

@ -3,14 +3,14 @@
.tab-bar-wrapper { .tab-bar-wrapper {
position: relative; position: relative;
border-bottom: 1px solid var(--border-color); // border-bottom: 1px solid var(--border-color);
user-select: none; user-select: none;
display: flex; display: flex;
.tab-bar { .tab-bar {
position: relative; // Needed for absolute positioning of child tabs position: relative; // Needed for absolute positioning of child tabs
margin-left: 100px; margin-left: 100px;
height: 38px; height: 40px;
// 36 is the width of add tab button // 36 is the width of add tab button
// 100 is offset from the left, for macOS window controls and dragging // 100 is offset from the left, for macOS window controls and dragging
// 50 right offset for dragging // 50 right offset for dragging