-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teacher Tool: Make Splitter Functional (#9887)
This makes it so the splitter can actually be used to resize the windows. I've also made it so you can double-click the split to reset it to its original position. I intentionally did not tie the split position into app state, so the control will be more reusable in the future, if we move it to react common. It'd be nice to merge this and the existing VerticalResizeContainer, but they've approached the problem from two somewhat different angles that makes the refactor a bit messy. The VerticalResizeContainer is a single window that can have its height changed, but it doesn't care what's shrinking/expanding below it. Meanwhile, this is a container for two different panels that manages both sides. In the future, I think it'd make sense to move this SplitPanel into React Common and take anything that's using the VerticalResizeContainer and have it use the SplitPanel instead, but I wanted to save that for another change.
- Loading branch information
Showing
5 changed files
with
194 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 61 additions & 66 deletions
127
teachertool/src/components/styling/SplitPane.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,62 @@ | ||
|
||
// TODO make this scssy | ||
|
||
.split-pane-vertical { | ||
display: flex; | ||
flex-direction: row; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
|
||
.left-vertical { | ||
flex: 1; | ||
overflow: auto; | ||
} | ||
|
||
.right-vertical { | ||
flex: 1; | ||
overflow: auto; | ||
} | ||
|
||
.splitter-vertical { | ||
background-color: var(--pxt-content-accent); | ||
width: 1px; | ||
} | ||
|
||
.splitter-vertical-inner { | ||
position: relative; | ||
background-color: transparent; | ||
transition: background-color 0.2s ease; | ||
left: -2.5px; | ||
width: 5px; | ||
height: 100%; | ||
cursor: ew-resize; | ||
z-index: 1; | ||
} | ||
|
||
.splitter-vertical-inner:hover { | ||
background-color: var(--pxt-content-foreground); | ||
transition: background-color 0.2s ease; | ||
transition-delay: 0.2s; | ||
} | ||
|
||
/* Horizontal split pane */ | ||
|
||
.split-pane-horizontal { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
|
||
.left-horizontal { | ||
flex: 1; | ||
overflow: auto; | ||
} | ||
|
||
.right-horizontal { | ||
flex: 1; | ||
overflow: auto; | ||
} | ||
|
||
.splitter-horizontal { | ||
flex: 0 0 1px; | ||
background-color: var(--pxt-headerbar-background); | ||
height: 5px; | ||
cursor: ns-resize; | ||
.split-pane { | ||
display: flex; | ||
height: 100%; | ||
width: 100%; | ||
|
||
.left { | ||
flex-grow: 0; | ||
flex-shrink: 0; | ||
overflow: auto; | ||
} | ||
|
||
.right { | ||
flex-grow: 1; | ||
flex-shrink: 1; | ||
overflow: auto; | ||
} | ||
|
||
.resizing-overlay { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
} | ||
} | ||
|
||
.split-vertical { | ||
flex-direction: row; | ||
|
||
.splitter { | ||
background-color: var(--pxt-content-accent); | ||
width: 1px; | ||
|
||
.splitter-inner { | ||
position: relative; | ||
background-color: transparent; | ||
transition: background-color 0.2s ease; | ||
left: -3px; | ||
width: 6px; | ||
height: 100%; | ||
cursor: ew-resize; | ||
z-index: 1; | ||
|
||
&:hover { | ||
background-color: var(--pxt-content-foreground); | ||
transition: background-color 0.2s ease; | ||
transition-delay: 0.2s; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.split-horizontal { | ||
flex-direction: column; | ||
|
||
.splitter { | ||
flex: 0 0 1px; | ||
background-color: var(--pxt-headerbar-background); | ||
height: 5px; | ||
cursor: ns-resize; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters