diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx index 4ff289c387..072f8a2e2b 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx @@ -128,31 +128,40 @@ export default class GraphOptionsCustomizableField extends PureComponent< connectDropTarget, visible, } = this.props - const opacity = isDragging ? 0.2 : 1 + + const fieldClass = `customizable-field${isDragging ? ' dragging' : ''}` + const labelClass = `${ + visible + ? 'customizable-field--label' + : 'customizable-field--label__hidden' + }` + + const visibilityTitle = visible + ? `Click to HIDE ${internalName}` + : `Click to SHOW ${internalName}` + return connectDragPreview( connectDropTarget( -
-
- {connectDragSource()} - - {internalName} +
+
+ {connectDragSource( +
+ +
+ )} +
+ +
+
{internalName}
* { + opacity: 0; + } + } } .customizable-field--label, .customizable-field--label__hidden { @include no-user-select(); height: 30px; - line-height: 30px; - font-weight: 600; - font-size: 13px; - padding: 0 11px; + display: flex; + flex-wrap: nowrap; + align-items: center; + padding: 0 11px 0 0; border-radius: 4px; width: 60%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; transition: background-color 0.25s ease, color 0.25s ease; > span { @@ -40,24 +47,12 @@ .customizable-field--label { color: $g14-chromium; background-color: $g5-pepper; - - &:hover { - cursor: pointer; - background-color: $g6-smoke; - color: $g17-whisper; - } } .customizable-field--label__hidden { background-color: $g4-onyx; - color: $g8-storm; + color: $g7-graphite; font-style: italic; - - &:hover { - cursor: pointer; - background-color: $g5-pepper; - color: $g13-mist; - } } .customizable-field--input { @@ -72,3 +67,67 @@ overflow: hidden; text-overflow: ellipsis; } +.customizable-field--name { + flex: 1 0 0; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-weight: 600; + font-size: 13px; + margin-left: 6px; +} +.customizable-field--drag, +.customizable-field--visibility { + display: inline-block; + width: 30px; + height: 30px; + position: relative; + + &:hover { + cursor: pointer; + } +} +.customizable-field--visibility { + width: 18px; +} +.customizable-field--drag .hamburger, +.customizable-field--visibility .icon { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} +.customizable-field--drag .hamburger { + width: 10px; + height: 2px; + background-color: $g11-sidewalk; + transition: background-color 0.25s ease; + border-radius: 1px; + + &:before, + &:after { + position: absolute; + display: block; + content: ''; + width: 100%; + height: 100%; + background-color: $g11-sidewalk; + transition: background-color 0.25s ease; + border-radius: 1px; + left: 0; + } + &:before { + top: -4px; + } + &:after { + top: 4px; + } +} + +.customizable-field--label__hidden .customizable-field--drag .hamburger { + &, + &:before, + &:after { + background-color: $g7-graphite; + } +}