From ab80eba7941eb7dbf4944ec63d52e1bfc7925ddc Mon Sep 17 00:00:00 2001
From: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
Date: Sat, 10 Feb 2024 22:19:17 +0000
Subject: [PATCH] chore(callouts): remove unnecessary whitespaces after class name (#833)

---
 quartz/components/Search.tsx |   68 +++++++++++++++++++++++----------
 1 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/quartz/components/Search.tsx b/quartz/components/Search.tsx
index f8dd804..a07dbc4 100644
--- a/quartz/components/Search.tsx
+++ b/quartz/components/Search.tsx
@@ -1,31 +1,57 @@
-import { QuartzComponentConstructor } from "./types"
+import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
 import style from "./styles/search.scss"
 // @ts-ignore
 import script from "./scripts/search.inline"
+import { classNames } from "../util/lang"
+import { i18n } from "../i18n"
 
-export default (() => {
-  function Search() {
-    return <div class="search">
-      <div id="search-icon">
-        <p>Search</p>
-        <div></div>
-        <svg tabIndex={0} aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7">
-          <title id="title">Search</title>
-          <desc id="desc">Search</desc>
-          <g class="search-path" fill="none">
-            <path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4" />
-            <circle cx="8" cy="8" r="7" />
-          </g>
-        </svg>
-      </div>
-      <div id="search-container">
-        <div id="search-space">
-          <input autocomplete="off" id="search-bar" name="search" type="text" aria-label="Search for something" placeholder="Search for something" />
-          <div id="results-container">
+export interface SearchOptions {
+  enablePreview: boolean
+}
+
+const defaultOptions: SearchOptions = {
+  enablePreview: true,
+}
+
+export default ((userOpts?: Partial<SearchOptions>) => {
+  function Search({ displayClass, cfg }: QuartzComponentProps) {
+    const opts = { ...defaultOptions, ...userOpts }
+    const searchPlaceholder = i18n(cfg.locale).components.search.searchBarPlaceholder
+    return (
+      <div class={classNames(displayClass, "search")}>
+        <div id="search-icon">
+          <p>{i18n(cfg.locale).components.search.title}</p>
+          <div></div>
+          <svg
+            tabIndex={0}
+            aria-labelledby="title desc"
+            role="img"
+            xmlns="http://www.w3.org/2000/svg"
+            viewBox="0 0 19.9 19.7"
+          >
+            <title id="title">Search</title>
+            <desc id="desc">Search</desc>
+            <g class="search-path" fill="none">
+              <path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4" />
+              <circle cx="8" cy="8" r="7" />
+            </g>
+          </svg>
+        </div>
+        <div id="search-container">
+          <div id="search-space">
+            <input
+              autocomplete="off"
+              id="search-bar"
+              name="search"
+              type="text"
+              aria-label={searchPlaceholder}
+              placeholder={searchPlaceholder}
+            />
+            <div id="search-layout" data-preview={opts.enablePreview}></div>
           </div>
         </div>
       </div>
-    </div>
+    )
   }
 
   Search.afterDOMLoaded = script

--
Gitblit v1.10.0