Skip to content

Commit

Permalink
Web text search integration
Browse files Browse the repository at this point in the history
  • Loading branch information
fgatti675 committed Dec 2, 2022
1 parent e94839c commit 3e2e5f3
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 16 deletions.
3 changes: 3 additions & 0 deletions lib/src/types/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ export type PropertyBuilderProps<M extends Record<string, any> = any> =
};

/**
* You can use this type to define a property dynamically, based
* on the current values of the entity, the previous values and the
* current value of the property, as well as the path and entity ID.
* @category Entity properties
*/
export type PropertyBuilder<T extends any = any, M extends Record<string, any> = any> =
Expand Down
3 changes: 3 additions & 0 deletions website/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
REACT_APP_DOC_SEARCH_KEY=""
REACT_APP_DOC_SEARCH_APP_ID=""
REACT_APP_GTAG_ID=""
Binary file modified website/.yarn/install-state.gz
Binary file not shown.
22 changes: 16 additions & 6 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('dotenv').config();
module.exports = {
title: "FireCMS",
tagline: "Awesome headless CMS based Firestore/Firebase and React, and completely open-source",
Expand All @@ -8,6 +9,10 @@ module.exports = {
favicon: "img/favicon.ico",
organizationName: "Camberi",
projectName: "FireCMS",
customFields: {
docSearchApiKey: process.env.REACT_APP_DOC_SEARCH_KEY,
docSearchAppId: process.env.REACT_APP_DOC_SEARCH_APP_ID,
},
plugins: [
"docusaurus-tailwindcss-loader",
"docusaurus-plugin-sass",
Expand Down Expand Up @@ -78,6 +83,11 @@ module.exports = {
label: "Blog",
position: "left"
},
{
type: "html",
position: "right",
value: "<div id=\"docsearch\"></div>"
},
{
type: "docsVersionDropdown",
position: "right",
Expand Down Expand Up @@ -205,13 +215,13 @@ module.exports = {
blog: {
showReadingTime: true
},
theme: {
customCss: [
require.resolve("./src/css/custom.css"),
]
},
// theme: {
// customCss: [
// require.resolve("./src/css/custom.css"),
// ]
// },
gtag: {
trackingID: "G-NL75PPNYXD"
trackingID: process.env.REACT_APP_GTAG_ID
},
sitemap: {
changefreq: 'weekly',
Expand Down
2 changes: 2 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"node": ">=14"
},
"dependencies": {
"@docsearch/js": "3",
"@docusaurus/core": "^2.2.0",
"@docusaurus/plugin-google-gtag": "^2.2.0",
"@docusaurus/plugin-sitemap": "^2.2.0",
Expand All @@ -25,6 +26,7 @@
"clsx": "^1.2.1",
"docusaurus-plugin-sass": "^0.2.2",
"docusaurus-plugin-typedoc": "^0.17.5",
"dotenv": "^16.0.3",
"postprocessing": "^6.29.1",
"raw-loader": "^4.0.2",
"react": "^18.2.0",
Expand Down
35 changes: 35 additions & 0 deletions website/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@
--ifm-font-family-base: 'Rubik', "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
--ifm-heading-font-family: 'Rubik', 'Noto Sans', sans-serif, Helvetica, Arial, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, system-ui, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
/*--ifm-code-background: 95%;*/

--docsearch-primary-color: #0070f4;
--docsearch-modal-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-searchbox-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-hit-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-key-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-footer-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-logo-color: #0070f4;
}

[data-theme='dark'] {
Expand Down Expand Up @@ -222,3 +230,30 @@ article {
article p img {
max-width: 800px;
}


html[data-theme="dark"] {
/*--docsearch-text-color: #f5f6f7;*/
/*--docsearch-container-background: rgba(9,10,17,0.8);*/
--docsearch-modal-background: #1b1b1d;
--docsearch-footer-background: #1b1b1d;
/*--docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;*/
/*--docsearch-searchbox-background: #090a11;*/
--docsearch-searchbox-focus-background: #111;
/*--docsearch-hit-color: #bec3c9;*/
/*--docsearch-hit-shadow: none;*/
/*--docsearch-hit-background: #090a11;*/
/*--docsearch-key-gradient: linear-gradient(-26.5deg,#565872,#31355b);*/
/*--docsearch-key-shadow: inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 rgba(3,4,9,0.3);*/
/*--docsearch-footer-background: #1e2136;*/
/*--docsearch-footer-shadow: inset 0 1px 0 0 rgba(73,76,106,0.5),0 -4px 8px 0 rgba(0,0,0,0.2);*/
--docsearch-logo-color: #0070f4;
/*--docsearch-muted-color: #7f8497;*/

--docsearch-primary-color: #0070f4;
--docsearch-modal-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-searchbox-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-hit-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-key-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
--docsearch-footer-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
}
17 changes: 16 additions & 1 deletion website/src/theme/Layout/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import React from "react";
import React, { useEffect } from "react";
import Layout from "@theme-original/Layout";
import { PagesBackground } from "../../partials/PagesBackground";
import docsearch from '@docsearch/js';
import siteConfig from '@generated/docusaurus.config';

import '@docsearch/css';
import '../../css/custom.css';

export default function LayoutWrapper(props) {

useEffect(() => {
docsearch({
container: '#docsearch',
appId: siteConfig.customFields.docSearchAppId,
apiKey: siteConfig.customFields.docSearchApiKey,
indexName: "firecms",
});
}, []);

return (
<>
<PagesBackground/>
Expand Down
102 changes: 93 additions & 9 deletions website/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ __metadata:
languageName: node
linkType: hard

"@algolia/autocomplete-core@npm:1.7.2":
version: 1.7.2
resolution: "@algolia/autocomplete-core@npm:1.7.2"
dependencies:
"@algolia/autocomplete-shared": 1.7.2
checksum: 7d3e879ac74f2d3fd6f80a01d6c05bd22264c428030396234112be7628a80d3a7c250613b2d4102f8ef63115be7b96d8d0231bdf8a02aa9b58873500aa61ffcc
languageName: node
linkType: hard

"@algolia/autocomplete-preset-algolia@npm:1.7.1":
version: 1.7.1
resolution: "@algolia/autocomplete-preset-algolia@npm:1.7.1"
Expand All @@ -26,13 +35,32 @@ __metadata:
languageName: node
linkType: hard

"@algolia/autocomplete-preset-algolia@npm:1.7.2":
version: 1.7.2
resolution: "@algolia/autocomplete-preset-algolia@npm:1.7.2"
dependencies:
"@algolia/autocomplete-shared": 1.7.2
peerDependencies:
"@algolia/client-search": ">= 4.9.1 < 6"
algoliasearch: ">= 4.9.1 < 6"
checksum: 7120ce1d312dbe6d898a0cecd9b28e45f9162a2fd9208a4c4e2efa77027455ee083c11cb782196374da717e990d6ca362c286ace475db97916e52bd277061d77
languageName: node
linkType: hard

"@algolia/autocomplete-shared@npm:1.7.1":
version: 1.7.1
resolution: "@algolia/autocomplete-shared@npm:1.7.1"
checksum: 0e137f1a470fab9b1bc493284b0be9b83503bda8aa37be9726a8fddf4791dccbd28f9eec399a7c75c1eb3196510dac7be454307fc97fbca2999f3fbc30756c28
languageName: node
linkType: hard

"@algolia/autocomplete-shared@npm:1.7.2":
version: 1.7.2
resolution: "@algolia/autocomplete-shared@npm:1.7.2"
checksum: 8336cd1e79e56e3901196862ae17896c6e9542e269a05860ab72d869e35f17ab0f40ecbe35d1e34617cc70749d3f8323d09b347c443a7b7b2b126dddb44779aa
languageName: node
linkType: hard

"@algolia/cache-browser-local-storage@npm:4.14.2":
version: 4.14.2
resolution: "@algolia/cache-browser-local-storage@npm:4.14.2"
Expand Down Expand Up @@ -1806,6 +1834,46 @@ __metadata:
languageName: node
linkType: hard

"@docsearch/css@npm:3.3.0":
version: 3.3.0
resolution: "@docsearch/css@npm:3.3.0"
checksum: 1cbf381fe0b454f933e736d04fe8a2d9f86c375022ef738b44d67a0b4c187b0d8fcb945a1ba5a404059e50e3968d9fe769de22779d071f6189f07c161239892c
languageName: node
linkType: hard

"@docsearch/js@npm:3":
version: 3.3.0
resolution: "@docsearch/js@npm:3.3.0"
dependencies:
"@docsearch/react": 3.3.0
preact: ^10.0.0
checksum: b612c6e91482419ccde4be30bf8c3fe095066fb0013941a6a3e201df33e108864a0d8fe5728571be6053cbfed32c2e38f86aec9584b365ff1ac2024cb64a7310
languageName: node
linkType: hard

"@docsearch/react@npm:3.3.0":
version: 3.3.0
resolution: "@docsearch/react@npm:3.3.0"
dependencies:
"@algolia/autocomplete-core": 1.7.2
"@algolia/autocomplete-preset-algolia": 1.7.2
"@docsearch/css": 3.3.0
algoliasearch: ^4.0.0
peerDependencies:
"@types/react": ">= 16.8.0 < 19.0.0"
react: ">= 16.8.0 < 19.0.0"
react-dom: ">= 16.8.0 < 19.0.0"
peerDependenciesMeta:
"@types/react":
optional: true
react:
optional: true
react-dom:
optional: true
checksum: 2bc4aa649fad3ff74e61537e674e658903c01509b2835827943f23895b40b7697476399179d43bc721f7e72044c797d4d793fcdaa394ff4f9fca1389a197a78c
languageName: node
linkType: hard

"@docsearch/react@npm:^3.1.1":
version: 3.2.1
resolution: "@docsearch/react@npm:3.2.1"
Expand Down Expand Up @@ -5153,6 +5221,13 @@ __metadata:
languageName: node
linkType: hard

"dotenv@npm:^16.0.3":
version: 16.0.3
resolution: "dotenv@npm:16.0.3"
checksum: afcf03f373d7a6d62c7e9afea6328e62851d627a4e73f2e12d0a8deae1cd375892004f3021883f8aec85932cd2834b091f568ced92b4774625b321db83b827f8
languageName: node
linkType: hard

"duplexer3@npm:^0.1.4":
version: 0.1.5
resolution: "duplexer3@npm:0.1.5"
Expand Down Expand Up @@ -9150,6 +9225,13 @@ __metadata:
languageName: node
linkType: hard

"preact@npm:^10.0.0":
version: 10.11.3
resolution: "preact@npm:10.11.3"
checksum: 9387115aa0581e8226309e6456e9856f17dfc0e3d3e63f774de80f3d462a882ba7c60914c05942cb51d51e23e120dcfe904b8d392d46f29ad15802941fe7a367
languageName: node
linkType: hard

"prepend-http@npm:^2.0.0":
version: 2.0.0
resolution: "prepend-http@npm:2.0.0"
Expand Down Expand Up @@ -11054,23 +11136,23 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^4.8.4":
version: 4.8.4
resolution: "typescript@npm:4.8.4"
"typescript@npm:^4.9.0":
version: 4.9.3
resolution: "typescript@npm:4.9.3"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 3e4f061658e0c8f36c820802fa809e0fd812b85687a9a2f5430bc3d0368e37d1c9605c3ce9b39df9a05af2ece67b1d844f9f6ea8ff42819f13bcb80f85629af0
checksum: 17b8f816050b412403e38d48eef0e893deb6be522d6dc7caf105e54a72e34daf6835c447735fd2b28b66784e72bfbf87f627abb4818a8e43d1fa8106396128dc
languageName: node
linkType: hard

"typescript@patch:typescript@^4.8.4#~builtin<compat/typescript>":
version: 4.8.4
resolution: "typescript@patch:typescript@npm%3A4.8.4#~builtin<compat/typescript>::version=4.8.4&hash=a1c5e5"
"typescript@patch:typescript@^4.9.0#~builtin<compat/typescript>":
version: 4.9.3
resolution: "typescript@patch:typescript@npm%3A4.9.3#~builtin<compat/typescript>::version=4.9.3&hash=a1c5e5"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 563a0ef47abae6df27a9a3ab38f75fc681f633ccf1a3502b1108e252e187787893de689220f4544aaf95a371a4eb3141e4a337deb9895de5ac3c1ca76430e5f0
checksum: ef65c22622d864497d0a0c5db693523329b3284c15fe632e93ad9aa059e8dc38ef3bd767d6f26b1e5ecf9446f49bd0f6c4e5714a2eeaf352805dc002479843d1
languageName: node
linkType: hard

Expand Down Expand Up @@ -11688,6 +11770,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "website@workspace:."
dependencies:
"@docsearch/js": 3
"@docusaurus/core": ^2.2.0
"@docusaurus/module-type-aliases": ^2.2.0
"@docusaurus/plugin-google-gtag": ^2.2.0
Expand All @@ -11703,6 +11786,7 @@ __metadata:
docusaurus-plugin-sass: ^0.2.2
docusaurus-plugin-typedoc: ^0.17.5
docusaurus-tailwindcss-loader: "file:plugins/docusaurus-tailwindcss-loader"
dotenv: ^16.0.3
postcss: ^8.4.18
postcss-import: ^15.0.0
postcss-loader: ^7.0.1
Expand All @@ -11718,7 +11802,7 @@ __metadata:
three: ^0.146.0
typedoc: ^0.23.20
typedoc-plugin-markdown: ^3.13.6
typescript: ^4.8.4
typescript: ^4.9.0
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 3e2e5f3

Please sign in to comment.