Skip to content

Commit c300557

Browse files
devvaannshabose
authored andcommitted
feat: unify layers panel field input styles
1 parent 95d800b commit c300557

2 files changed

Lines changed: 51 additions & 64 deletions

File tree

‎src/nls/root/strings.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ define({
845845
"LIVE_PREVIEW_LAYERS_EDIT_STYLE": "Edit in Styles Bar",
846846
"LIVE_PREVIEW_LAYERS_ADD_DECLARATION": "Add Declaration",
847847
"LIVE_PREVIEW_LAYERS_REMOVE_DECLARATION": "Remove Declaration",
848+
"LIVE_PREVIEW_LAYERS_EDIT_DECLARATION": "Edit Declaration",
848849
"LIVE_PREVIEW_LAYERS_SHOW_SCRIPT_NODES": "Show Script-Generated Elements",
849850
"LIVE_PREVIEW_LAYERS_SCRIPT_GENERATED": "Generated by script, not in the source file",
850851

‎src/styles/Extn-LayersPanel.less‎

Lines changed: 50 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,38 @@
6767
}
6868
}
6969

70+
.layers-field-input() {
71+
box-sizing: border-box;
72+
height: 22px;
73+
padding: 0 6px;
74+
margin: 0;
75+
border: 1px solid transparent;
76+
border-radius: 4px;
77+
outline: none;
78+
box-shadow: none;
79+
background: transparent;
80+
color: @project-panel-text-1;
81+
font-family: @layers-mono;
82+
font-size: @sidebar-xs-font-size;
83+
line-height: 20px;
84+
85+
&::placeholder {
86+
color: @project-panel-text-2;
87+
opacity: 0.6;
88+
}
89+
90+
&:hover:not([readonly]) {
91+
border-color: @layers-border;
92+
background: @layers-input-bg;
93+
}
94+
95+
&:focus {
96+
border-color: @layers-accent;
97+
background: @layers-input-bg-focus;
98+
box-shadow: 0 0 0 2px @layers-accent-soft;
99+
}
100+
}
101+
70102
.layers-tab-container {
71103
display: flex;
72104
flex-direction: column;
@@ -651,34 +683,12 @@
651683
}
652684

653685
.layers-prop-input[type="text"] {
686+
.layers-field-input();
654687
flex: 1;
655688
min-width: 0;
656-
height: 22px;
657-
padding: 0 5px;
658-
margin: 0;
659-
border: 1px solid transparent;
660-
border-radius: 4px;
661-
outline: none;
662-
box-shadow: none;
663-
background: transparent;
664-
color: @project-panel-text-1;
665-
font-family: @layers-mono;
666-
font-size: @sidebar-xs-font-size;
667689
text-overflow: ellipsis;
668690

669-
&::placeholder {
670-
color: @project-panel-text-2;
671-
opacity: 0.6;
672-
}
673-
674-
&:hover:not([readonly]) {
675-
border-color: @layers-border;
676-
background: @layers-input-bg;
677-
}
678-
679691
&:focus {
680-
border-color: @layers-accent;
681-
background: @layers-input-bg-focus;
682692
text-overflow: clip;
683693
}
684694

@@ -768,12 +778,12 @@
768778

769779
.layers-decl {
770780
display: flex;
771-
align-items: baseline;
772-
min-height: 20px;
781+
align-items: center;
782+
min-height: 26px;
773783
padding: 0 4px 0 8px;
774784
font-family: @layers-mono;
775785
font-size: @sidebar-xs-font-size;
776-
line-height: 18px;
786+
line-height: 22px;
777787
user-select: none;
778788

779789
&:hover {
@@ -794,51 +804,28 @@
794804
.layers-decl-value {
795805
flex: 0 1 auto;
796806
min-width: 0;
807+
margin-left: 5px;
797808
color: @layers-prop-value;
798809
word-break: break-all;
799810
}
800811

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-
821812
.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;
813+
.layers-field-input();
814+
flex: 0 1 auto;
815+
min-width: 3ch;
816+
max-width: 100%;
817+
padding: 0 4px;
818+
border-color: @layers-border;
819+
background: @layers-input-bg;
833820
text-decoration: none;
834821

835-
&::placeholder {
836-
color: @project-panel-text-2;
837-
opacity: 0.6;
822+
&.layers-decl-name {
823+
color: @layers-prop-name;
838824
}
839825

840826
&.layers-decl-value {
841-
flex: 1;
827+
margin: 0 3px 0 5px;
828+
color: @layers-prop-value;
842829
}
843830
}
844831

@@ -849,11 +836,10 @@
849836
.layers-decl-actions {
850837
display: flex;
851838
align-items: center;
852-
gap: 1px;
839+
gap: 2px;
853840
flex: none;
854-
align-self: center;
855841
margin-left: auto;
856-
padding-left: 6px;
842+
padding-left: 8px;
857843
}
858844

859845
.layers-decl.layers-overridden {

0 commit comments

Comments
 (0)