react-sortable-tree-node
Version:
react-sortable-tree-node
212 lines (211 loc) • 4.76 kB
CSS
.rowWrapper {
height: 100%;
box-sizing: border-box;
cursor: move;
}
.rowWrapper:hover {
opacity: 0.7;
background-color: #e8e8e8;
}
.rowWrapper:active {
opacity: 1;
}
.rowWrapperLandingPadActive:hover {
background-color: unset;
}
.rowWrapperDragDisabled {
cursor: default;
}
.row {
height: 100%;
white-space: nowrap;
display: flex;
position: relative;
}
.row > * {
box-sizing: border-box;
}
.rowSelected {
background-color: #d1efff;
}
/** * The outline of where the element will go if dropped, displayed while dragging */
.rowLandingPad, .rowCancelPad {
border: none;
box-shadow: none;
outline: none;
}
.rowLandingPad *, .rowCancelPad * {
opacity: 0 ;
}
.rowLandingPad::before, .rowCancelPad::before {
background-color: lightblue;
border: 2px dotted black;
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
}
/** * Alternate appearance of the landing pad when the dragged location is invalid */
.rowCancelPad::before {
background-color: #e6a8ad;
}
/** * Nodes matching the search conditions are highlighted */
.rowSearchMatch {
box-shadow: inset 0 -7px 7px -3px #0080ff;
}
/** * The node that matches the search conditions and is currently focused */
.rowSearchFocus {
box-shadow: inset 0 -7px 7px -3px #fc6421;
}
.rowContents, .rowLabel, .rowToolbar, .toolbarButton {
display: inline-block;
vertical-align: middle;
}
.rowContents {
position: relative;
height: 100%;
flex: 1 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
}
.rowLabel {
flex: 0 1 auto;
padding-right: 20px;
}
.rowToolbar {
flex: 0 1 auto;
display: flex;
}
.toolbarButton {
display: flex;
align-items: center;
}
/** * Line for under a node with children */
.lineChildren {
height: 100%;
display: inline-block;
}
/* ========================================================================== Scaffold Line-overlaid blocks used for showing the tree structure ========================================================================== */
.lineBlock, .absoluteLineBlock {
height: 100%;
position: relative;
display: inline-block;
flex: 0 0 auto;
}
.absoluteLineBlock {
position: absolute;
top: 0;
}
/* Highlight line for pointing to dragged row destination ========================================================================== */
/** * +--+--+ * | | | * | | | * | | | * +--+--+ */
.highlightLineVertical {
z-index: 3;
}
.highlightLineVertical::before {
position: absolute;
content: '';
background-color: #36c2f6;
width: 6px;
margin-left: -3px;
left: 50%;
top: 0;
height: 100%;
}
@keyframes arrow-pulse {
0% {
transform: translate(0, 0);
opacity: 0;
}
30% {
transform: translate(0, 300%);
opacity: 1;
}
70% {
transform: translate(0, 700%);
opacity: 1;
}
100% {
transform: translate(0, 1000%);
opacity: 0;
}
}
.highlightLineVertical::after {
content: '';
position: absolute;
height: 0;
margin-left: -3px;
left: 50%;
top: 0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 3px solid white;
animation: arrow-pulse 1s infinite linear both;
}
/** * +-----+ * | | * | +--+ * | | | * +--+--+ */
.highlightTopLeftCorner::before {
z-index: 3;
content: '';
position: absolute;
border-top: solid 6px #36c2f6;
border-left: solid 6px #36c2f6;
box-sizing: border-box;
height: calc(50% + 3px);
top: 50%;
margin-top: -3px;
right: 0;
width: calc(50% + 3px);
}
/** * +--+--+ * | | | * | | | * | +->| * +-----+ */
.highlightBottomLeftCorner {
z-index: 3;
}
.highlightBottomLeftCorner::before {
content: '';
position: absolute;
border-bottom: solid 6px #36c2f6;
border-left: solid 6px #36c2f6;
box-sizing: border-box;
height: calc(100% + 3px);
top: 0;
right: 7px;
width: calc(50% - 4px);
}
.highlightBottomLeftCorner::after {
content: '';
position: absolute;
height: 0;
right: 0;
top: 100%;
margin-top: -7px;
border-top: 7px solid transparent;
border-bottom: 7px solid transparent;
border-left: 7px solid #36c2f6;
}
/* icons */
.arrowContainer {
position: absolute;
top: 50%;
left: -8px;
transform: translate(-100%, -50%);
display: flex;
align-items: center;
cursor: pointer;
}
.arrow {
border: solid black;
border-width: 0 3px 3px 0;
display: inline-block;
padding: 3px;
}
.right {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
.down {
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}