From 091cc1b05e55114b488590e087cf0da9d3f87ab5 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 11 Apr 2025 00:43:35 +0000
Subject: [PATCH] fix(search): properly show mobile layout
---
quartz/components/styles/search.scss | 12 ++++++++++--
quartz/components/scripts/search.inline.ts | 8 +++++---
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts
index d95f468..27f74ec 100644
--- a/quartz/components/scripts/search.inline.ts
+++ b/quartz/components/scripts/search.inline.ts
@@ -300,9 +300,11 @@
itemTile.classList.add("result-card")
itemTile.id = slug
itemTile.href = resolveUrl(slug).toString()
- itemTile.innerHTML = `<h3>${title}</h3>${htmlTags}${
- enablePreview && window.innerWidth > 600 ? "" : `<p>${content}</p>`
- }`
+ itemTile.innerHTML = `
+ <h3 class="card-title">${title}</h3>
+ ${htmlTags}
+ <p class="card-description">${content}</p>
+ `
itemTile.addEventListener("click", (event) => {
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return
hideSearch()
diff --git a/quartz/components/styles/search.scss b/quartz/components/styles/search.scss
index 182b56b..2cf98ce 100644
--- a/quartz/components/styles/search.scss
+++ b/quartz/components/styles/search.scss
@@ -133,11 +133,13 @@
}
@media all and ($mobile) {
- & > #preview-container {
+ flex-direction: column;
+
+ & > .preview-container {
display: none !important;
}
- &[data-preview] > #results-container {
+ &[data-preview] > .results-container {
width: 100%;
height: auto;
flex: 0 0 100%;
@@ -204,6 +206,12 @@
margin: 0;
}
+ @media all and not ($mobile) {
+ & > p.card-description {
+ display: none;
+ }
+ }
+
& > ul.tags {
margin-top: 0.45rem;
margin-bottom: 0;
--
Gitblit v1.10.0