diff --git a/src/assets/javascripts/templates/clipboard/index.tsx b/src/assets/javascripts/templates/clipboard/index.tsx
index b9b470be9..8e2a28172 100644
--- a/src/assets/javascripts/templates/clipboard/index.tsx
+++ b/src/assets/javascripts/templates/clipboard/index.tsx
@@ -52,7 +52,7 @@ export function renderClipboard(
)
}
diff --git a/src/assets/javascripts/templates/search/index.ts b/src/assets/javascripts/templates/search/index.ts
deleted file mode 100644
index cda3d7d1b..000000000
--- a/src/assets/javascripts/templates/search/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2016-2020 Martin Donath
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-export * from "./result"
diff --git a/src/assets/javascripts/templates/search/result/article/index.tsx b/src/assets/javascripts/templates/search/index.tsx
similarity index 70%
rename from src/assets/javascripts/templates/search/result/article/index.tsx
rename to src/assets/javascripts/templates/search/index.tsx
index 4dc56bba0..f6f5c688b 100644
--- a/src/assets/javascripts/templates/search/result/article/index.tsx
+++ b/src/assets/javascripts/templates/search/index.tsx
@@ -21,7 +21,7 @@
*/
import { h } from "extensions"
-import { ArticleDocument } from "modules"
+import { SearchResult } from "modules"
import { truncate } from "utilities"
/* ----------------------------------------------------------------------------
@@ -32,8 +32,10 @@ import { truncate } from "utilities"
* CSS classes
*/
const css = {
+ item: "md-search-result__item",
link: "md-search-result__link",
article: "md-search-result__article md-search-result__article--document",
+ section: "md-search-result__article",
title: "md-search-result__title",
teaser: "md-search-result__teaser"
}
@@ -43,24 +45,32 @@ const css = {
* ------------------------------------------------------------------------- */
/**
- * Render an article document
+ * Render a search result
*
- * @param article - Article document
+ * @param result - Search result
*
* @return HTML element
*/
-export function renderArticleDocument(
- { location, title, text }: ArticleDocument
+export function renderSearchResult(
+ { article, sections }: SearchResult
): HTMLElement {
+ const children = [article, ...sections].map(document => {
+ const { location, title, text } = document
+ return (
+
+
+
)
}
diff --git a/src/assets/javascripts/templates/search/result/index.ts b/src/assets/javascripts/templates/search/result/index.ts
deleted file mode 100644
index 8bf56dec7..000000000
--- a/src/assets/javascripts/templates/search/result/index.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2016-2020 Martin Donath
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-export * from "./_"
diff --git a/src/assets/javascripts/templates/search/result/section/index.tsx b/src/assets/javascripts/templates/search/result/section/index.tsx
deleted file mode 100644
index 12ea8f05b..000000000
--- a/src/assets/javascripts/templates/search/result/section/index.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2016-2020 Martin Donath
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-import { h } from "extensions"
-import { SectionDocument } from "modules"
-import { truncate } from "utilities"
-
-/* ----------------------------------------------------------------------------
- * Data
- * ------------------------------------------------------------------------- */
-
-/**
- * CSS classes
- */
-const css = {
- link: "md-search-result__link",
- article: "md-search-result__article",
- title: "md-search-result__title",
- teaser: "md-search-result__teaser"
-}
-
-/* ----------------------------------------------------------------------------
- * Functions
- * ------------------------------------------------------------------------- */
-
-/**
- * Render a section document
- *
- * @param section - Section document
- *
- * @return HTML element
- */
-export function renderSectionDocument(
- { location, title, text }: SectionDocument
-): HTMLElement {
- return (
-
-
-