Skip to content

Commit d250773

Browse files
Merge pull request #12 from onattech/main
Algolia search, sticky media, emailjs improvements
2 parents 7f40d14 + 74a67d4 commit d250773

File tree

7 files changed

+130
-25
lines changed

7 files changed

+130
-25
lines changed

.env.development

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
EMAILJS_SERVER_ID=service_sedddrb
22
EMAILJS_TEMPLATE_ID=template_2w42djr
3-
EMAILJS_PUBLIC_KEY=6_tNcp-iBTQ09T2Ql
3+
EMAILJS_PUBLIC_KEY=6_tNcp-iBTQ09T2Ql
4+
APPLICATION_ID=QREGAGU3YC
5+
API_KEY=95b0c6179810e72eefdf5f0e8915ac85

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
EMAILJS_SERVER_ID=service_sedddrb
22
EMAILJS_TEMPLATE_ID=template_2w42djr
3-
EMAILJS_PUBLIC_KEY=6_tNcp-iBTQ09T2Ql
3+
EMAILJS_PUBLIC_KEY=6_tNcp-iBTQ09T2Ql
4+
APPLICATION_ID=QREGAGU3YC
5+
API_KEY=95b0c6179810e72eefdf5f0e8915ac85

config.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"index_name": "docsearch",
3+
"sitemap_urls": [
4+
"https://docs.appseed.us/sitemap.xml"
5+
],
6+
"sitemap_alternate_links": true,
7+
"selectors": {
8+
"lvl0": {
9+
"selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]",
10+
"type": "xpath",
11+
"global": true,
12+
"default_value": "Documentation"
13+
},
14+
"lvl1": "header h1",
15+
"lvl2": "article h2",
16+
"lvl3": "article h3",
17+
"lvl4": "article h4",
18+
"lvl5": "article h5, article td:first-child",
19+
"lvl6": "article h6",
20+
"text": "article p, article li, article td:last-child"
21+
},
22+
"strip_chars": " .,;:#",
23+
"custom_settings": {
24+
"separatorsToIndex": "_",
25+
"attributesForFaceting": [
26+
"language",
27+
"version",
28+
"type",
29+
"docusaurus_tag"
30+
],
31+
"attributesToRetrieve": [
32+
"hierarchy",
33+
"content",
34+
"anchor",
35+
"url",
36+
"url_without_anchor",
37+
"type"
38+
]
39+
},
40+
"conversation_id": [
41+
"833762294"
42+
],
43+
"nb_hits": 46250
44+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Sticky Media
3+
sidebar_label: Sticky Media
4+
---
5+
6+
# Sticky media
7+
8+
You may add a sticky video by giving `sticky-popup` class to an `a` tag.
9+
10+
```html
11+
<!-- md content above -->
12+
13+
<a className="sticky-popup" target="_blank" href="https://www.youtube.com/watch?v=uRgQ_TpTj4g">Sticky video</a>
14+
15+
<!-- md content below -->
16+
```
17+
18+
## Try it!
19+
20+
<a
21+
className="sticky-popup"
22+
target="_blank"
23+
href="https://www.youtube.com/watch?v=uRgQ_TpTj4g"
24+
data-video-id="uRgQ_TpTj4g"
25+
>Sticky video</a>

docusaurus.config.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const lightCodeTheme = require("prism-react-renderer/themes/github");
66
// const darkCodeTheme = require("prism-react-renderer/themes/dracula");
77
// const Embed = require("./plugins/remark/embed");
88
const darkCodeTheme = require("prism-react-renderer/themes/shadesOfPurple");
9+
require('dotenv').config()
910
const customFields = {
1011
meta: {
1112
title: "An atom based state manager for JavaScript apps.",
@@ -52,6 +53,16 @@ const config = {
5253
defaultLocale: "en",
5354
locales: ["en"],
5455
},
56+
57+
scripts: [
58+
{
59+
src: '//cdn.jsdelivr.net/gh/app-generator/[email protected]/dist/index.min.js',
60+
id: 'stickyVideoScript',
61+
defer: true,
62+
class: 'sticky-popup',
63+
},
64+
],
65+
5566
// themes: ["@docusaurus/theme-live-codeblock"],
5667
plugins: [
5768
// "docusaurus-plugin-sass",
@@ -253,8 +264,8 @@ const config = {
253264
darkTheme: darkCodeTheme,
254265
},
255266
algolia: {
256-
appId: "QREGAGU3YC",
257-
apiKey: "95b0c6179810e72eefdf5f0e8915ac85",
267+
appId: process.env.APPLICATION_ID,
268+
apiKey: process.env.API_KEY,
258269
indexName: "docsearch",
259270
contextualSearch: true,
260271
searchParameters: {},

src/css/custom.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,11 @@ ul.menu__list > li > a.menu__link--active {
265265
}
266266

267267
/* Home Page Header */
268+
269+
/* Sticky media */
270+
.sticky-video-modal {
271+
width: 100%;
272+
height: 100%;
273+
right: 0;
274+
bottom: 0;
275+
}

src/theme/NotFound.js

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,37 @@ export default function NotFound() {
1010
const location = useLocation();
1111
const { siteConfig } = useDocusaurusContext();
1212

13-
const serverId = 'service_3xvalkw' ; // process.env.EMAILJS_SERVER_ID;
14-
const templateId = 'template_gpdzs7i' ; // process.env.EMAILJS_TEMPLATE_ID;
15-
const publicKey = 'mbYWDBjQhv-h3CLXl'; // process.env.EMAILJS_PUBLIC_KEY;
13+
const serverId = siteConfig.customFields.EMAILJS_SERVER_ID
14+
const templateId = siteConfig.customFields.EMAILJS_TEMPLATE_ID
15+
const publicKey = siteConfig.customFields.EMAILJS_PUBLIC_KEY
1616

17-
//console.log('serverId :' + serverId );
18-
//console.log('templateId :' + templateId );
19-
//console.log('publicKey :' + publicKey );
20-
21-
useEffect(async () => {
22-
emailjs.send(serverId, templateId, { url: "https://docs.appseed.us" + location.pathname }, publicKey).then(
23-
function (response) {
24-
console.log("SUCCESS!", response.status, response.text);
25-
},
26-
function (error) {
27-
console.log("FAILED...", error);
28-
}
29-
);
30-
}, []);
17+
useEffect(() => {
18+
if (!serverId || !templateId || !publicKey) return
19+
20+
async function emailJS() {
21+
emailjs
22+
.send(
23+
serverId,
24+
templateId,
25+
{
26+
url:
27+
'https://docusaurus-soft-design.onrender.com' +
28+
location.pathname,
29+
},
30+
publicKey
31+
)
32+
.then(
33+
function (response) {
34+
console.log('SUCCESS!', response.status, response.text)
35+
},
36+
function (error) {
37+
console.log('FAILED...', error)
38+
}
39+
)
40+
}
41+
42+
emailJS()
43+
}, [])
3144
return (
3245
<>
3346
<PageMetadata
@@ -45,18 +58,18 @@ export default function NotFound() {
4558
Page Not Found
4659
</Translate>
4760
</h1>
48-
<p>
61+
<div>
4962
<Translate id="theme.NotFound.p1" description="The first paragraph of the 404 page">
5063
Sorry but the page you were looking for could not be found.
5164
</Translate>
52-
</p>
53-
<p>
65+
</div>
66+
<div>
5467
<div className="py-4 md:mr-20 justify-center ">
5568
<Link className="bg-white no-underline hover:no-underline rounded-md text-black px-4 py-2 " to="/">
5669
Back to Home Page
5770
</Link>
5871
</div>
59-
</p>
72+
</div>
6073
</div>
6174
</div>
6275
</main>

0 commit comments

Comments
 (0)