Style vertical position
parent
63248f497a
commit
fc04094442
|
@ -27,7 +27,7 @@ class TimeMachine extends PureComponent<Props> {
|
||||||
<Resizer
|
<Resizer
|
||||||
topMinPixels={440}
|
topMinPixels={440}
|
||||||
bottomMinPixels={200}
|
bottomMinPixels={200}
|
||||||
orientation={HANDLE_VERTICAL}
|
orientation={HANDLE_HORIZONTAL}
|
||||||
containerClass="page-contents"
|
containerClass="page-contents"
|
||||||
>
|
>
|
||||||
{this.renderEditor}
|
{this.renderEditor}
|
||||||
|
@ -40,7 +40,7 @@ class TimeMachine extends PureComponent<Props> {
|
||||||
return (
|
return (
|
||||||
<Threesizer
|
<Threesizer
|
||||||
divisions={this.visPlusBuilder}
|
divisions={this.visPlusBuilder}
|
||||||
orientation={HANDLE_HORIZONTAL}
|
orientation={HANDLE_VERTICAL}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class TimeMachine extends PureComponent<Props> {
|
||||||
|
|
||||||
private get renderEditor() {
|
private get renderEditor() {
|
||||||
return (
|
return (
|
||||||
<Threesizer divisions={this.divisions} orientation={HANDLE_HORIZONTAL} />
|
<Threesizer divisions={this.divisions} orientation={HANDLE_VERTICAL} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, {PureComponent, ReactElement, MouseEvent} from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
import FancyScrollbar from 'src/shared/components/FancyScrollbar'
|
import FancyScrollbar from 'src/shared/components/FancyScrollbar'
|
||||||
|
import {HANDLE_VERTICAL, HANDLE_HORIZONTAL} from 'src/shared/constants/index'
|
||||||
|
|
||||||
const NOOP = () => {}
|
const NOOP = () => {}
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ class Division extends PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const {name, render} = this.props
|
const {name, render, orientation} = this.props
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={this.containerClass} style={this.containerStyle}>
|
<div className={this.containerClass} style={this.containerStyle}>
|
||||||
|
@ -36,9 +37,12 @@ class Division extends PureComponent<Props> {
|
||||||
onDoubleClick={this.handleDoubleClick}
|
onDoubleClick={this.handleDoubleClick}
|
||||||
title={this.title}
|
title={this.title}
|
||||||
>
|
>
|
||||||
{name}
|
<div className="threesizer--title">{name}</div>
|
||||||
</div>
|
</div>
|
||||||
<FancyScrollbar className="threesizer--contents" autoHide={true}>
|
<FancyScrollbar
|
||||||
|
className={`threesizer--contents ${orientation}`}
|
||||||
|
autoHide={true}
|
||||||
|
>
|
||||||
{render()}
|
{render()}
|
||||||
</FancyScrollbar>
|
</FancyScrollbar>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,13 +55,22 @@ class Division extends PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private get containerStyle() {
|
private get containerStyle() {
|
||||||
const {size, offset} = this.props
|
if (this.props.orientation === HANDLE_HORIZONTAL) {
|
||||||
|
return {
|
||||||
|
height: this.size,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
height: `calc((100% - ${offset}px) * ${size} + 30px)`,
|
width: this.size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get size(): string {
|
||||||
|
const {size, offset} = this.props
|
||||||
|
return `calc((100% - ${offset}px) * ${size} + 30px)`
|
||||||
|
}
|
||||||
|
|
||||||
private get containerClass(): string {
|
private get containerClass(): string {
|
||||||
const isAnyHandleBeingDragged = !!this.props.activeHandleID
|
const isAnyHandleBeingDragged = !!this.props.activeHandleID
|
||||||
return classnames('threesizer--division', {
|
return classnames('threesizer--division', {
|
||||||
|
@ -66,11 +79,13 @@ class Division extends PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private get className(): string {
|
private get className(): string {
|
||||||
const {draggable} = this.props
|
const {draggable, orientation} = this.props
|
||||||
|
|
||||||
return classnames('threesizer--handle', {
|
return classnames('threesizer--handle', {
|
||||||
disabled: !draggable,
|
disabled: !draggable,
|
||||||
dragging: this.isDragging,
|
dragging: this.isDragging,
|
||||||
|
vertical: orientation === HANDLE_VERTICAL,
|
||||||
|
horizonatl: orientation === HANDLE_HORIZONTAL,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,49 +4,63 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$threesizer-handle: 30px;
|
$threesizer-handle: 30px;
|
||||||
$threesizer-handle-z: 2;
|
|
||||||
$threesizer-contents-z: 1;
|
|
||||||
|
|
||||||
.threesizer {
|
.threesizer {
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
|
|
||||||
&.dragging .threesizer--division {
|
&.dragging .threesizer--division {
|
||||||
@include no-user-select();
|
@include no-user-select();
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.vertical {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.horizontal {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.threesizer--division {
|
.threesizer--division {
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
|
||||||
transition: height 0.25s ease-in-out, width 0.25s ease-in-out;
|
transition: height 0.25s ease-in-out, width 0.25s ease-in-out;
|
||||||
|
|
||||||
&.dragging {
|
&.dragging {
|
||||||
transition: none;
|
transition: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vertical & {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.horizontal & {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draggable Handle With Title */
|
/* Draggable Handle With Title */
|
||||||
.threesizer--handle {
|
.threesizer--handle {
|
||||||
position: relative;
|
|
||||||
z-index: $threesizer-handle-z;
|
|
||||||
@include no-user-select();
|
@include no-user-select();
|
||||||
height: $threesizer-handle;
|
|
||||||
background-color: $g4-onyx;
|
background-color: $g4-onyx;
|
||||||
padding: 0 12px;
|
|
||||||
line-height: $threesizer-handle;
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
color: $g11-sidewalk;
|
|
||||||
transition: background-color 0.25s ease, color 0.25s ease;
|
transition: background-color 0.25s ease, color 0.25s ease;
|
||||||
|
|
||||||
|
&.vertical {
|
||||||
|
width: $threesizer-handle;
|
||||||
|
padding: 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.horizontal {
|
||||||
|
height: $threesizer-handle;
|
||||||
|
padding: 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: row-resize;
|
cursor: row-resize;
|
||||||
color: $g16-pearl;
|
color: $g16-pearl;
|
||||||
|
@ -60,11 +74,23 @@ $threesizer-contents-z: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.threesizer--title {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: $g11-sidewalk;
|
||||||
|
|
||||||
|
.vertical & {
|
||||||
|
transform: rotate(90deg) translateX(8px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Division Contents */
|
/* Division Contents */
|
||||||
.threesizer--contents {
|
.threesizer--contents {
|
||||||
position: absolute !important;
|
&.horizontal {
|
||||||
top: $threesizer-handle;
|
height: calc(100% - #{$threesizer-handle}) !important;
|
||||||
z-index: $threesizer-contents-z;
|
}
|
||||||
width: 100%;
|
&.vertical {
|
||||||
height: calc(100% - #{$threesizer-handle}) !important;
|
width: calc(100% - #{$threesizer-handle}) !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue