Skip to content

Commit c7bf846

Browse files
devvaannshabose
authored andcommitted
feat: add styles for layers panel inline style editing
1 parent 5eee9a9 commit c7bf846

2 files changed

Lines changed: 71 additions & 9 deletions

File tree

‎src/nls/root/strings.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,8 @@ define({
843843
"LIVE_PREVIEW_LAYERS_OPEN_SOURCE": "Open in editor",
844844
"LIVE_PREVIEW_LAYERS_RULE_INACTIVE": "Not active in the current state",
845845
"LIVE_PREVIEW_LAYERS_EDIT_STYLE": "Edit in Styles Bar",
846+
"LIVE_PREVIEW_LAYERS_ADD_DECLARATION": "Add Declaration",
847+
"LIVE_PREVIEW_LAYERS_REMOVE_DECLARATION": "Remove Declaration",
846848
"LIVE_PREVIEW_LAYERS_SHOW_SCRIPT_NODES": "Show Script-Generated Elements",
847849
"LIVE_PREVIEW_LAYERS_SCRIPT_GENERATED": "Generated by script, not in the source file",
848850

‎src/styles/Extn-LayersPanel.less‎

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -769,12 +769,12 @@
769769
.layers-decl {
770770
display: flex;
771771
align-items: baseline;
772-
gap: 4px;
773772
min-height: 20px;
774-
padding-left: 8px;
773+
padding: 0 4px 0 8px;
775774
font-family: @layers-mono;
776775
font-size: @sidebar-xs-font-size;
777-
user-select: text;
776+
line-height: 18px;
777+
user-select: none;
778778

779779
&:hover {
780780
background: @layers-hover-bg;
@@ -792,15 +792,72 @@
792792
}
793793

794794
.layers-decl-value {
795-
flex: 1;
795+
flex: 0 1 auto;
796796
min-width: 0;
797797
color: @layers-prop-value;
798798
word-break: break-all;
799799
}
800800

801+
.layers-decl-field,
802+
.layers-decl-input {
803+
margin: 0 -2px;
804+
805+
&.layers-decl-value {
806+
margin-left: 3px;
807+
}
808+
}
809+
810+
.layers-decl-field {
811+
padding: 0 2px;
812+
border-radius: 3px;
813+
cursor: text;
814+
815+
&:hover {
816+
background: @layers-input-bg-focus;
817+
box-shadow: inset 0 0 0 1px @layers-border;
818+
}
819+
}
820+
821+
.layers-decl-input {
822+
box-sizing: border-box;
823+
height: 18px;
824+
min-width: 0;
825+
padding: 0 2px;
826+
border: 1px solid @layers-accent;
827+
border-radius: 3px;
828+
outline: none;
829+
box-shadow: none;
830+
background: @layers-input-bg-focus;
831+
font: inherit;
832+
line-height: 16px;
833+
text-decoration: none;
834+
835+
&::placeholder {
836+
color: @project-panel-text-2;
837+
opacity: 0.6;
838+
}
839+
840+
&.layers-decl-value {
841+
flex: 1;
842+
}
843+
}
844+
845+
.layers-decl.layers-editing:hover {
846+
background: transparent;
847+
}
848+
849+
.layers-decl-actions {
850+
display: flex;
851+
align-items: center;
852+
gap: 1px;
853+
flex: none;
854+
align-self: center;
855+
margin-left: auto;
856+
padding-left: 6px;
857+
}
858+
801859
.layers-decl.layers-overridden {
802-
.layers-decl-name,
803-
.layers-decl-value {
860+
.layers-decl-field {
804861
text-decoration: line-through;
805862
color: @project-panel-text-2;
806863
}
@@ -811,18 +868,21 @@
811868
align-self: center;
812869
}
813870

814-
.layers-decl .layers-icon-btn {
871+
.layers-decl .layers-icon-btn,
872+
.layers-rule-add {
815873
opacity: 0;
816874
}
817875

818876
.layers-decl:hover .layers-icon-btn,
819-
.layers-decl .layers-icon-btn:focus {
877+
.layers-decl .layers-icon-btn:focus,
878+
.layers-rule:hover .layers-rule-add,
879+
.layers-rule-add:focus {
820880
opacity: 1;
821881
}
822882

823883
.layers-rule {
824884
margin-bottom: 6px;
825-
padding-bottom: 6px;
885+
padding-bottom: 8px;
826886
border-bottom: 1px solid @layers-border;
827887

828888
&:last-child {

0 commit comments

Comments
 (0)