-
Notifications
You must be signed in to change notification settings - Fork 297
/
_search.scss
178 lines (156 loc) · 3.74 KB
/
_search.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/**
* Search field
**/
.bd-search {
position: relative;
padding-left: 0.5rem;
gap: 0.5rem;
background-color: var(--pst-color-background);
border-radius: $admonition-border-radius;
border: 1px solid var(--pst-color-border);
color: var(--pst-color-text-base);
// Background should always be same color regardless of active or not
&:active {
background-color: var(--pst-color-background);
color: var(--pst-color-text-muted);
}
.icon {
position: absolute;
color: var(--pst-color-border);
left: 25px;
}
.fa-solid.fa-magnifying-glass {
position: absolute;
left: calc((2.5rem - 0.7em) / 2);
color: var(--pst-color-text-muted);
}
input {
// Inner-text of the search bar
&::placeholder {
color: var(--pst-color-text-muted);
}
// Remove the little "x" that pops up when you start typing
&::-webkit-search-cancel-button,
&::-webkit-search-decoration {
-webkit-appearance: none;
appearance: none;
}
}
// Shows off the keyboard shortcuts for the button
.search-button__kbd-shortcut {
display: flex;
position: absolute;
right: 0.5rem;
color: var(--pst-color-border);
}
}
.form-control {
background-color: var(--pst-color-background);
&:focus,
&:focus-visible {
border: none;
box-shadow: none;
outline: 3px solid var(--pst-color-accent);
background-color: var(--pst-color-background);
color: var(--pst-color-text-muted);
}
}
/**
* Search button - located in the navbar
*/
// Search link icon should be a bit bigger since it is separate from icon links
.search-button {
display: flex;
align-items: center;
align-content: center;
color: var(--pst-color-text-muted);
// Needed to match other icons hover
padding: 0 0 0.25rem 0;
border-radius: 0;
@include icon-navbar-hover;
@include focus-indicator;
i {
font-size: 1.3rem;
}
}
// __search-container will only show up when we use the search pop-up bar
.search-button__search-container,
.search-button__overlay {
display: none;
}
.search-button__wrapper.show {
.search-button__search-container {
display: flex;
// Center in middle of screen just underneath header
position: fixed;
z-index: $zindex-modal;
top: 30%;
left: 50%;
transform: translate(-50%, -50%);
right: 1rem;
margin-top: 0.5rem;
width: 90%;
max-width: 800px;
}
.search-button__overlay {
display: flex;
position: fixed;
z-index: $zindex-modal-backdrop;
background-color: black;
opacity: 0.5;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
}
form.bd-search {
flex-grow: 1;
padding-top: 0;
padding-bottom: 0;
}
// Font and input text a bit bigger
svg,
input {
font-size: var(--pst-font-size-icon);
}
}
/**
* The search button component that looks like a field.
* Lives at components/search-button-field.html
*/
.search-button-field {
display: inline-flex;
align-items: center;
border: var(--pst-color-border) solid 1px;
border-radius: 1.5em;
color: var(--pst-color-text-muted);
padding: 0.5em;
background-color: var(--pst-color-surface);
&:hover {
border: 2px solid var(--pst-color-link-hover);
}
&:focus-visible {
border: 2px solid var(--pst-color-accent);
}
// The keyboard shotcut text
.search-button__kbd-shortcut {
font-size: var(--bs-nav-link-font-size);
font-weight: var(--bs-nav-link-font-weight);
margin-right: 0.5em;
margin-left: 0.5em;
}
.kbd-shortcut__modifier {
font-size: 0.75em;
}
// Ensures that all the text lines up in the middle
> * {
align-items: center;
}
// Only the icon should be visible on narrow screens
> :not(svg) {
display: none;
@include media-breakpoint-up(lg) {
display: flex;
}
}
}