rezizer styles updated

- updated resizer styles
- removed Tailwind classes (we will remove it in the future)
- updated components styles that use `Resize` in order to support its update
This commit is contained in:
Pavel Laptev 2024-02-27 22:16:52 +01:00 committed by Mattias Granlund
parent 0404a3a0bd
commit 7b1499e797
6 changed files with 101 additions and 47 deletions

View File

@ -353,6 +353,9 @@
inside={$selectedFiles.length > 0} inside={$selectedFiles.length > 0}
minWidth={320} minWidth={320}
sticky sticky
defaultLineColor={$selectedFiles.length > 0
? 'transparent'
: 'var(--clr-theme-container-outline-light)'}
on:width={(e) => { on:width={(e) => {
laneWidth = e.detail / (16 * $userSettings.zoom); laneWidth = e.detail / (16 * $userSettings.zoom);
lscache.set(laneWidthKey + branch.id, laneWidth, 7 * 1440); // 7 day ttl lscache.set(laneWidthKey + branch.id, laneWidth, 7 * 1440); // 7 day ttl
@ -386,21 +389,8 @@
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
width: var(--space-4);
height: 100%; height: 100%;
transform: translateX(var(--selected-resize-shift)); transform: translateX(var(--selected-resize-shift));
&:after {
pointer-events: none;
content: '';
position: absolute;
top: 0;
right: 0;
width: 1px;
height: 100%;
opacity: var(--selected-opacity);
background-color: var(--clr-theme-container-outline-light);
}
} }
.branch-card__dropzone-wrapper { .branch-card__dropzone-wrapper {

View File

@ -118,6 +118,7 @@
direction="right" direction="right"
inside inside
minWidth={240} minWidth={240}
defaultLineColor="var(--clr-theme-container-outline-light)"
on:width={(e) => { on:width={(e) => {
fileWidth = e.detail / (16 * $userSettings.zoom); fileWidth = e.detail / (16 * $userSettings.zoom);
lscache.set(fileWidthKey + branch.id, fileWidth, 7 * 1440); // 7 day ttl lscache.set(fileWidthKey + branch.id, fileWidth, 7 * 1440); // 7 day ttl
@ -151,7 +152,7 @@
} }
.file-selected { .file-selected {
--selected-resize-shift: calc(var(--space-6) * -1); --selected-resize-shift: calc((var(--space-6) + 0.0625rem) * -1);
--selected-target-branch-right-padding: calc(var(--space-4) * -1); --selected-target-branch-right-padding: calc(var(--space-4) * -1);
--selected-opacity: 0; --selected-opacity: 0;
} }
@ -165,7 +166,7 @@
align-items: self-start; align-items: self-start;
padding: var(--space-12) var(--space-12) var(--space-12) 0; padding: var(--space-12) var(--space-12) var(--space-12) 0;
border-right: 1px solid var(--clr-theme-container-outline-light); /* border-right: 1px solid var(--clr-theme-container-outline-light); */
margin-left: var(--selected-target-branch-right-padding); margin-left: var(--selected-target-branch-right-padding);
} }
</style> </style>

View File

@ -147,6 +147,7 @@
viewport={rsViewport} viewport={rsViewport}
direction="up" direction="up"
inside inside
defaultLineColor="var(--clr-theme-container-outline-light)"
minHeight={90} minHeight={90}
on:height={(e) => { on:height={(e) => {
$height = Math.min(maxHeight, e.detail / (16 * $userSettings.zoom)); $height = Math.min(maxHeight, e.detail / (16 * $userSettings.zoom));

View File

@ -51,7 +51,6 @@
width: 100%; width: 100%;
padding: var(--space-12); padding: var(--space-12);
gap: var(--space-8); gap: var(--space-8);
border-top: 1px solid var(--clr-theme-container-outline-light);
border-bottom: 1px solid transparent; border-bottom: 1px solid transparent;
transition: border-bottom var(--transition-fast); transition: border-bottom var(--transition-fast);
position: relative; position: relative;

View File

@ -72,7 +72,7 @@
</div> </div>
{:else} {:else}
<div <div
class="navigation relative flex w-80 shrink-0 flex-col border-r" class="navigation relative"
style:width={$defaultTrayWidthRem ? $defaultTrayWidthRem + 'rem' : null} style:width={$defaultTrayWidthRem ? $defaultTrayWidthRem + 'rem' : null}
bind:this={viewport} bind:this={viewport}
role="menu" role="menu"
@ -89,9 +89,9 @@
on:click={toggleNavCollapse} on:click={toggleNavCollapse}
/> />
</div> </div>
<div class="domains"> <div class="navigation-top">
<ProjectSelector {project} {projectService} /> <ProjectSelector {project} {projectService} />
<div class="flex flex-col gap-1"> <div class="domains">
<BaseBranchCard {project} {baseBranchService} {githubService} {isNavCollapsed} /> <BaseBranchCard {project} {baseBranchService} {githubService} {isNavCollapsed} />
<DomainButton <DomainButton
href={`/${project.id}/board`} href={`/${project.id}/board`}
@ -108,7 +108,8 @@
<Resizer <Resizer
{viewport} {viewport}
direction="right" direction="right"
minWidth={320} minWidth={280}
defaultLineColor="var(--clr-theme-container-outline-light)"
on:width={(e) => { on:width={(e) => {
$defaultTrayWidthRem = e.detail / (16 * $userSettings.zoom); $defaultTrayWidthRem = e.detail / (16 * $userSettings.zoom);
}} }}
@ -118,7 +119,10 @@
<style lang="postcss"> <style lang="postcss">
.navigation { .navigation {
border-right: 1px solid var(--clr-theme-container-outline-light); display: flex;
flex-direction: column;
position: relative;
/* border-right: 1px solid var(--clr-theme-container-outline-light); */
background: var(--clr-theme-container-light); background: var(--clr-theme-container-light);
max-height: 100%; max-height: 100%;
user-select: none; user-select: none;
@ -127,15 +131,25 @@
flex-shrink: 0; flex-shrink: 0;
height: var(--space-24); height: var(--space-24);
} }
.domains { .navigation-top {
display: flex;
flex-direction: column;
padding-bottom: var(--space-24); padding-bottom: var(--space-24);
padding-left: var(--space-12); padding-left: var(--space-12);
padding-right: var(--space-12); padding-right: var(--space-12);
} }
.domains {
display: flex;
flex-direction: column;
gap: var(--space-4);
}
.hide-nav-button { .hide-nav-button {
align-self: flex-end; align-self: flex-end;
margin-right: var(--space-12); margin-right: var(--space-12);
} }
/* COLLAPSED */
.collapsed-nav-wrapper { .collapsed-nav-wrapper {
padding: var(--space-12); padding: var(--space-12);
height: 100%; height: 100%;

View File

@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { pxToRem } from '$lib/utils/pxToRem';
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
// The element that is being resized // The element that is being resized
@ -7,9 +8,13 @@
// Sets direction of resizing for viewport // Sets direction of resizing for viewport
export let direction: 'left' | 'right' | 'up' | 'down'; export let direction: 'left' | 'right' | 'up' | 'down';
// Sets the color of the line
export let defaultLineColor: string = 'none';
export let defaultLineThickness: number = 1;
export let hoverLineThickness: number = 2;
// Needed when overflow is hidden // Needed when overflow is hidden
export let inside = false; export let inside = false;
export let sticky = false; export let sticky = false;
// //
@ -71,10 +76,10 @@
<div <div
on:mousedown={onMouseDown} on:mousedown={onMouseDown}
class="resizer"
tabindex="0" tabindex="0"
role="slider" role="slider"
aria-valuenow={viewport?.clientHeight} aria-valuenow={viewport?.clientHeight}
class="resizer"
class:inside class:inside
class:dragging class:dragging
class:vertical={orientation == 'vertical'} class:vertical={orientation == 'vertical'}
@ -84,68 +89,112 @@
class:left={direction == 'left'} class:left={direction == 'left'}
class:right={direction == 'right'} class:right={direction == 'right'}
class:sticky class:sticky
/> >
<div
class="resizer-line"
style="--resizer-default-line-color: {defaultLineColor}; --resizer-default-line-thickness: {pxToRem(
defaultLineThickness
)}; --resizer-hover-line-thickness: {pxToRem(hoverLineThickness)}"
/>
</div>
<style lang="postcss"> <style lang="postcss">
.resizer { .resizer {
position: absolute; --resizer-frame-thickness: var(--space-4);
transition: background-color 0.1s ease-out; --resizer-default-line-thickness: var(--space-2);
/* background-color: var(--clr-theme-container-outline-light); */ --resizer-hover-line-thickness: var(--space-8);
&:hover { --resizer-default-line-color: none;
transition-delay: 0.1s;
}
z-index: 40; z-index: 40;
position: absolute;
&:hover, &:hover,
&:focus, &:focus,
&.dragging { &.dragging {
background-color: var(--clr-theme-container-outline-light);
outline: none; outline: none;
& .resizer-line {
transition-delay: 0.1s;
background-color: var(--clr-theme-scale-ntrl-50);
}
} }
} }
.resizer-line {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--resizer-default-line-color);
pointer-events: none;
transition:
background-color 0.1s ease-out,
width 0.1s ease-out,
height 0.1s ease-out;
}
.horizontal { .horizontal {
width: var(--space-4); width: var(--space-4);
height: 100%; height: 100%;
cursor: col-resize; cursor: col-resize;
top: 0; top: 0;
& .resizer-line {
width: var(--resizer-default-line-thickness);
}
&:hover { &:hover {
width: var(--space-4); & .resizer-line {
width: var(--resizer-hover-line-thickness);
}
} }
} }
.vertical { .vertical {
height: var(--space-4); height: var(--space-4);
width: 100%; width: 100%;
cursor: row-resize; cursor: row-resize;
left: 0;
& .resizer-line {
height: var(--resizer-default-line-thickness);
}
&:hover { &:hover {
height: var(--space-4); & .resizer-line {
height: var(--resizer-hover-line-thickness);
}
} }
} }
.right { .right {
right: calc(-1 * var(--space-2)); right: 0;
&.inside {
right: 0; & .resizer-line {
left: auto;
} }
} }
.left { .left {
left: 0; left: 0;
&:hover {
width: var(--space-4); & .resizer-line {
right: auto;
} }
} }
.up { .up {
top: 0; top: 0;
&:hover {
height: var(--space-4); & .resizer-line {
bottom: auto;
} }
} }
.down { .down {
bottom: calc(-1 * var(--space-2)); bottom: 0;
&:hover {
height: var(--space-4); & .resizer-line {
} top: auto;
&.inside {
bottom: 0;
} }
} }
.sticky { .sticky {
position: sticky; position: sticky;
top: 0; top: 0;