Skip to content

Commit 9556dcb

Browse files
committed
feat: Improve styling of search
1 parent 1314cab commit 9556dcb

File tree

2 files changed

+59
-29
lines changed

2 files changed

+59
-29
lines changed

assets/sass/_variables.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $color-onLight: #000000;
1616
$color-table-border: #5b5b5b;
1717

1818
html {
19-
--pagefind-ui-scale: 1;
19+
--pagefind-ui-scale: 1 !important;
2020
--pagefind-ui-text: #000;
2121
--link-default: #{$link-default};
2222
--link-hovered: #{$link-hovered};

assets/sass/search.scss

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,56 @@
1-
.o-search {
1+
#search {
22
width: 100%;
3-
height: 6rem;
43
display: flex;
54
z-index: 6;
65

76
@media print {
87
display: none;
98
}
109

11-
&--contentpage {
12-
position: sticky;
13-
display: none;
14-
top: 10vh;
15-
opacity: 0;
16-
visibility: hidden;
17-
transition: opacity 0.5s ease;
10+
.pagefind-ui__search-input,
11+
.pagefind-ui__message {
12+
font-family: "Roboto", Arial, Helvetica, sans-serif;
13+
font-weight: 400;
1814
}
1915

20-
&--show {
21-
display: block;
22-
opacity: 1;
23-
visibility: visible;
24-
z-index: 6;
16+
.pagefind-ui__message {
17+
padding: 1rem;
2518
}
2619

27-
.pagefind-ui__search-input,
28-
.pagefind-ui__message,
29-
.pagefind-ui__search-clear {
30-
font-family: "Roboto", Arial, Helvetica, sans-serif;
20+
.pagefind-ui__results-area {
21+
margin-top: 0;
22+
}
23+
24+
.pagefind-ui__results li:last-child {
25+
border-bottom: none;
3126
}
3227

3328
input.pagefind-ui__search-input {
3429
z-index: 6;
3530
outline: 0.2rem solid transparent;
3631
border: var(--border);
3732
box-shadow: var(--box-shadow);
33+
border-radius: var(--border-radius-l);
3834

3935
@include focus-indicator(0.2rem);
4036

4137
&::placeholder {
4238
opacity: 0.7;
4339
color: var(--color-body);
4440
}
41+
42+
// This selector is used to identify if search results are visible
43+
&:has(
44+
+ .pagefind-ui__search-clear
45+
+ .pagefind-ui__drawer
46+
.pagefind-ui__results-area
47+
) {
48+
border-radius: var(--border-radius-l) var(--border-radius-l) 0 0;
49+
}
4550
}
4651

4752
button.pagefind-ui__search-clear {
48-
z-index: 6;
49-
height: auto;
50-
padding: 1rem;
51-
top: 1rem;
52-
margin-right: 0.7rem;
53+
display: none;
5354
}
5455

5556
.pagefind-ui__suppressed {
@@ -62,14 +63,26 @@
6263

6364
.pagefind-ui__drawer {
6465
background-color: var(--bg-default);
65-
padding: 0 1rem 1rem 1rem;
66+
padding: 0 1rem;
6667
overscroll-behavior: contain;
67-
height: 35rem;
68-
top: 0.4rem;
6968
overflow-y: scroll;
70-
position: relative;
71-
border-radius: var(--pagefind-ui-border-radius);
69+
position: absolute;
70+
top: 6.2rem;
71+
width: 100%;
7272
z-index: 6;
73+
max-height: 50vh;
74+
border: var(--border);
75+
}
76+
77+
.pagefind-ui__result {
78+
padding: 2rem 0;
79+
margin: 0 1rem;
80+
border-top: 2px solid grey;
81+
}
82+
83+
.pagefind-ui__result-inner,
84+
.pagefind-ui__result-thumb {
85+
margin-top: 0;
7386
}
7487

7588
.pagefind-ui__result-link {
@@ -113,3 +126,20 @@
113126
}
114127
}
115128
}
129+
130+
.o-search {
131+
&--contentpage {
132+
position: absolute;
133+
display: none;
134+
opacity: 0;
135+
visibility: hidden;
136+
transition: opacity 0.5s ease;
137+
}
138+
139+
&--show {
140+
display: block;
141+
opacity: 1;
142+
visibility: visible;
143+
z-index: 6;
144+
}
145+
}

0 commit comments

Comments
 (0)