Skip to content

Commit 6c86cb0

Browse files
authored
Fix the filters title covering other labels (#354)
Fix #293 There's still a slight difference. The only way to avoid that completely, would be to remove the default checkbox, and style our own. But I'm not really keen on that solution. BTW this styling/positioning will probably be further improved in #292 , so this is just a quick solution to make it look better.
1 parent 895626d commit 6c86cb0

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

dist/readthedocs-addons.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/readthedocs-addons.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/search.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,27 @@ div.hit-block .hit-block-heading-container svg {
283283
letter-spacing: 1px;
284284
}
285285

286-
:host > div .filters li.title {
286+
:host > div .filters-title {
287+
display: block;
287288
font-size: 0.9rem;
288289
position: absolute;
289-
top: 75px;
290+
top: 0;
291+
left: 14px;
290292
background: rgb(252, 252, 252);
291293
margin: 0 5px;
292294
padding: 0 5px;
293295
}
294296

295297
:host > div .filters {
296-
padding: 5px 10px;
298+
position: relative;
299+
padding-top: 0.9rem;
297300
margin: 0 1.15em;
301+
}
302+
303+
:host > div .filters ul {
304+
display: block;
305+
margin: 0;
306+
padding: 5px 14px;
298307
border-radius: 0.3rem;
299308
border-style: solid;
300309
border-width: 1px;

src/search.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,22 @@ export class SearchElement extends LitElement {
227227
// https://lit.dev/docs/templates/lists/#repeating-templates-with-map
228228
return html`
229229
<div class="filters">
230-
<li class="title">Filters</li>
231-
${this.filters.map(
232-
(filter, index) => html`
233-
<li>
234-
<input
235-
@click=${this.filterClicked}
236-
id="filter-${index}"
237-
type="checkbox"
238-
value="${filter.value}"
239-
/>
240-
<label for="filter-${index}"> ${filter.name} </label>
241-
</li>
242-
`,
243-
)}
230+
<span class="filters-title">Filters</span>
231+
<ul>
232+
${this.filters.map(
233+
(filter, index) => html`
234+
<li>
235+
<input
236+
@click=${this.filterClicked}
237+
id="filter-${index}"
238+
type="checkbox"
239+
value="${filter.value}"
240+
/>
241+
<label for="filter-${index}"> ${filter.name} </label>
242+
</li>
243+
`,
244+
)}
245+
</ul>
244246
</div>
245247
`;
246248
}

0 commit comments

Comments
 (0)