-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
style.scss
139 lines (117 loc) · 3.1 KB
/
style.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
$button-spacing-x: $grid-unit-10 + math.div($grid-unit-05, 2); // 10px
$button-spacing-y: math.div($grid-unit-15, 2); // 6px
.wp-block-search__button {
margin-left: $button-spacing-x;
word-break: normal;
&.has-icon {
line-height: 0;
}
svg {
min-width: $grid-unit-30;
min-height: $grid-unit-30;
width: 1.25em;
height: 1.25em;
fill: currentColor;
vertical-align: text-bottom;
}
}
// These rules are set to zero specificity to keep the default styles for search buttons.
// They are needed for backwards compatibility.
:where(.wp-block-search__button) {
border: 1px solid $gray-400;
padding: $button-spacing-y $button-spacing-x;
}
.wp-block-search__inside-wrapper {
display: flex;
flex: auto;
flex-wrap: nowrap;
max-width: 100%;
}
.wp-block-search__label {
width: 100%;
}
.wp-block-search__input {
padding: $grid-unit-10;
flex-grow: 1;
margin-left: 0;
margin-right: 0;
min-width: 3rem;
border: 1px solid $gray-600;
// !important used to forcibly prevent undesired application of
// text-decoration styles on the input field.
text-decoration: unset !important;
// Hides a redundant extra search icon on Mobile Safari.
appearance: initial;
}
.wp-block-search.wp-block-search__button-only {
.wp-block-search__button {
margin-left: 0;
// Prevent unintended text wrapping.
flex-shrink: 0;
max-width: 100%;
}
// Ensure minimum input field width in small viewports.
.wp-block-search__button[aria-expanded="true"] {
max-width: calc(100% - 100px);
}
.wp-block-search__inside-wrapper {
transition-property: width;
min-width: 0 !important;
}
.wp-block-search__input {
transition-duration: 300ms;
flex-basis: 100%;
}
// !important here to override inline styles on button only deselected view.
&.wp-block-search__searchfield-hidden {
overflow: hidden;
.wp-block-search__inside-wrapper {
overflow: hidden;
}
.wp-block-search__input {
width: 0 !important;
min-width: 0 !important;
padding-left: 0 !important;
padding-right: 0 !important;
border-left-width: 0 !important;
border-right-width: 0 !important;
flex-grow: 0;
margin: 0;
flex-basis: 0;
}
}
}
// We are lowering the specificity so that the input element can override the rule for the input element inside the search block.
:where(.wp-block-search__input) {
font-family: inherit;
font-weight: inherit;
font-size: inherit;
line-height: inherit;
letter-spacing: inherit;
}
// We are lowering the specificity so that the button element can override the rule for the button inside the search block.
:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) {
padding: $grid-unit-05;
border: 1px solid $gray-600;
box-sizing: border-box;
.wp-block-search__input {
border-radius: 0;
border: none;
padding: 0 $grid-unit-05;
&:focus {
outline: none;
}
}
// For lower specificity.
:where(.wp-block-search__button) {
padding: $grid-unit-05 $grid-unit-10;
}
}
.wp-block-search.aligncenter .wp-block-search__inside-wrapper {
margin: auto;
}
.wp-block[data-align="right"] .wp-block-search.wp-block-search__button-only {
.wp-block-search__inside-wrapper {
float: right;
}
}