fix blocks blurry border (#104)

This commit is contained in:
Red J Adaya 2024-07-09 13:31:38 +08:00 committed by GitHub
parent c57c7ea220
commit 6d6102b912
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 199 additions and 129 deletions

View File

@ -22,17 +22,17 @@ body {
} }
*::-webkit-scrollbar-track { *::-webkit-scrollbar-track {
background-color: var(--scrollbar-background-color) !important; background-color: var(--scrollbar-background-color);
} }
*::-webkit-scrollbar-thumb { *::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-thumb-color) !important; background-color: var(--scrollbar-thumb-color);
border-radius: 4px; border-radius: 4px;
margin: 0 1px 0 1px; margin: 0 1px 0 1px;
} }
*::-webkit-scrollbar-thumb:hover { *::-webkit-scrollbar-thumb:hover {
background-color: var(--scrollbar-thumb-hover-color) !important; background-color: var(--scrollbar-thumb-hover-color);
} }
.flex-spacer { .flex-spacer {
@ -61,3 +61,18 @@ body {
--os-handle-bg-hover: var(--scrollbar-thumb-hover-color); --os-handle-bg-hover: var(--scrollbar-thumb-hover-color);
--os-handle-bg-active: var(--scrollbar-thumb-active-color); --os-handle-bg-active: var(--scrollbar-thumb-active-color);
} }
.scrollbar-hide-until-hover {
*::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-track {
display: none;
}
*::-webkit-scrollbar-corner {
display: none;
}
*:hover::-webkit-scrollbar-thumb {
display: block;
}
}

View File

@ -12,7 +12,6 @@
min-height: 0; min-height: 0;
position: relative; position: relative;
border-radius: 8px; border-radius: 8px;
background-color: rgba(255, 255, 255, 0.1);
.block-frame-icon { .block-frame-icon {
margin-right: 0.5em; margin-right: 0.5em;
@ -56,16 +55,16 @@
} }
&.block-frame-default { &.block-frame-default {
border: 2px solid transparent; position: relative;
padding: 2px;
&.block-focused { .block-frame-default-inner {
border: 2px solid var(--accent-color); background-color: rgba(255, 255, 255, 0.05);
width: 100%;
&.block-no-highlight, height: 100%;
&.block-preview { border-radius: 8px;
border: 2px solid transparent; display: flex;
} flex-direction: column;
}
.block-frame-default-header { .block-frame-default-header {
display: flex; display: flex;
@ -75,7 +74,7 @@
gap: 8px; gap: 8px;
align-self: stretch; align-self: stretch;
font: var(--header-font); font: var(--header-font);
background-color: #262626; background-color: rgba(255, 255, 255, 0.1);
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
.block-frame-default-header-iconview { .block-frame-default-header-iconview {
@ -162,11 +161,39 @@
} }
} }
} }
}
.block-frame-preview { .block-frame-preview {
background-color: var(--main-bg-color); background-color: rgba(0, 0, 0, 0.7);
width: 100%; width: 100%;
flex-grow: 1; flex-grow: 1;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
}
}
.block-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border: 2px solid transparent;
pointer-events: none;
padding: 2px;
border-radius: 8px;
}
&.block-focused {
.block-mask {
border: 2px solid var(--accent-color);
}
&.block-no-highlight,
&.block-preview {
.block-mask {
border: 2px solid rgba(255, 255, 255, 0.1);
}
}
}
} }
} }

View File

@ -293,6 +293,8 @@ const BlockFrame_Default_Component = ({
ref={blockModel?.blockRef} ref={blockModel?.blockRef}
style={style} style={style}
> >
<div className="block-mask"></div>
<div className="block-frame-default-inner">
<div <div
className="block-frame-default-header" className="block-frame-default-header"
ref={layoutModel?.dragHandleRef} ref={layoutModel?.dragHandleRef}
@ -312,6 +314,7 @@ const BlockFrame_Default_Component = ({
</div> </div>
{preview ? <div className="block-frame-preview" /> : children} {preview ? <div className="block-frame-preview" /> : children}
</div> </div>
</div>
); );
}; };

View File

@ -5,7 +5,7 @@
position: absolute; position: absolute;
width: 130px; width: 130px;
height: 100%; height: 100%;
padding: 6px 3px; padding: 6px 3px 0px;
box-sizing: border-box; box-sizing: border-box;
font-weight: bold; font-weight: bold;
color: var(--secondary-text-color); color: var(--secondary-text-color);

View File

@ -10,7 +10,7 @@
.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: 40px; height: 33px;
// 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

View File

@ -19,10 +19,11 @@
--warning-color: rgb(224, 185, 86); --warning-color: rgb(224, 185, 86);
--success-color: rgb(78, 154, 6); --success-color: rgb(78, 154, 6);
--hover-bg-color: rgba(255, 255, 255, 0.1); --hover-bg-color: rgba(255, 255, 255, 0.1);
--block-bg-color: rgba(255, 255, 255, 0.05);
/* scrollbar colors */ /* scrollbar colors */
--scrollbar-background-color: var(--main-bg-color); --scrollbar-background-color: transparent;
--scrollbar-thumb-color: rgba(255, 255, 255, 0.3); --scrollbar-thumb-color: rgba(255, 255, 255, 0.15);
--scrollbar-thumb-hover-color: rgba(255, 255, 255, 0.5); --scrollbar-thumb-hover-color: rgba(255, 255, 255, 0.5);
--scrollbar-thumb-active-color: rgba(255, 255, 255, 0.6); --scrollbar-thumb-active-color: rgba(255, 255, 255, 0.6);

View File

@ -399,7 +399,7 @@ function PreviewView({ blockId, model }: { blockId: string; model: PreviewModel
}, 10); }, 10);
return ( return (
<div ref={ref} className="full-preview"> <div ref={ref} className="full-preview scrollbar-hide-until-hover">
<DirNav cwdAtom={fileNameAtom} /> <DirNav cwdAtom={fileNameAtom} />
{specializedView} {specializedView}
</div> </div>

View File

@ -107,4 +107,28 @@
} }
} }
} }
.terminal {
*::-webkit-scrollbar {
width: 4px;
height: 4px;
}
*::-webkit-scrollbar-track {
background-color: var(--scrollbar-background-color);
}
*::-webkit-scrollbar-thumb {
display: none;
background-color: var(--scrollbar-thumb-color);
border-radius: 4px;
margin: 0 1px 0 1px;
}
&:hover {
*::-webkit-scrollbar-thumb {
display: block;
}
}
}
} }