Skip to content

Commit 3b10a4d

Browse files
fix: align Algolia search button
1 parent 27f243b commit 3b10a4d

4 files changed

Lines changed: 98 additions & 19 deletions

File tree

docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ const config: Config = {
276276
max: 1030,
277277
min: 640,
278278
steps: 2,
279-
disableInDev: false,
279+
disableInDev: true,
280280
},
281281
],
282282
],

src/components/AlgoliaSiteSearch/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ declare global {
2323
applicationId: string;
2424
apiKey: string;
2525
indexName: string;
26+
insights?: boolean;
2627
attributes: {
2728
primaryText: string;
2829
secondaryText: string;
@@ -32,6 +33,7 @@ declare global {
3233
};
3334
darkMode: boolean;
3435
}) => void;
36+
destroy?: (container: string) => void;
3537
};
3638
}
3739
}
@@ -115,6 +117,7 @@ export default function AlgoliaSiteSearch(): React.ReactElement | null {
115117
applicationId,
116118
apiKey,
117119
indexName,
120+
insights: false,
118121
attributes: {
119122
primaryText: "title",
120123
secondaryText: "description",
@@ -131,6 +134,7 @@ export default function AlgoliaSiteSearch(): React.ReactElement | null {
131134

132135
return () => {
133136
cancelled = true;
137+
window.SiteSearch?.destroy?.(`#${containerId}`);
134138
};
135139
}, [apiKey, applicationId, indexName, isConfigured]);
136140

src/css/custom.css

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,72 @@ html {
13881388
box-sizing: border-box !important;
13891389
}
13901390

1391+
.algolia-sitesearch-navbar {
1392+
display: flex !important;
1393+
align-items: center !important;
1394+
padding: 0.2rem 0.3rem !important;
1395+
}
1396+
1397+
.algolia-sitesearch-navbar #algolia-sitesearch-navbar {
1398+
display: flex;
1399+
align-items: center;
1400+
}
1401+
1402+
.algolia-sitesearch-navbar .sitesearch-button {
1403+
position: relative !important;
1404+
display: flex !important;
1405+
align-items: center !important;
1406+
justify-content: space-between !important;
1407+
box-sizing: border-box !important;
1408+
width: 250px;
1409+
height: 36px !important;
1410+
min-width: 250px !important;
1411+
padding: 0 12px 0 48px !important;
1412+
line-height: 1 !important;
1413+
transform: none !important;
1414+
white-space: nowrap;
1415+
overflow: hidden;
1416+
}
1417+
1418+
.algolia-sitesearch-navbar .sitesearch-button:hover {
1419+
transform: none !important;
1420+
}
1421+
1422+
.algolia-sitesearch-navbar .sitesearch-button .search-icon {
1423+
position: absolute !important;
1424+
top: 50% !important;
1425+
left: 16px !important;
1426+
display: inline-flex !important;
1427+
align-items: center !important;
1428+
justify-content: center !important;
1429+
width: 18px !important;
1430+
height: 18px !important;
1431+
margin: 0 !important;
1432+
line-height: 0 !important;
1433+
pointer-events: none;
1434+
transform: translateY(-50%) !important;
1435+
}
1436+
1437+
.algolia-sitesearch-navbar .sitesearch-button .search-icon svg {
1438+
display: block;
1439+
width: 18px !important;
1440+
height: 18px !important;
1441+
margin: 0 !important;
1442+
}
1443+
1444+
.algolia-sitesearch-navbar .sitesearch-button .button-text {
1445+
flex: 1 1 auto;
1446+
min-width: 0;
1447+
overflow: hidden;
1448+
text-align: left;
1449+
text-overflow: ellipsis;
1450+
}
1451+
1452+
.algolia-sitesearch-navbar .sitesearch-button .keyboard-shortcut {
1453+
margin-left: 10px;
1454+
flex-shrink: 0;
1455+
}
1456+
13911457
[data-theme="dark"] .explore-btn:hover {
13921458
color: white;
13931459
}

static/pinterest-init.js

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
console.log("✅ pinterest-init.js loaded");
2-
!(function (e) {
3-
if (!window.pintrk) {
4-
window.pintrk = function () {
5-
window.pintrk.queue.push(Array.prototype.slice.call(arguments));
6-
};
7-
var n = window.pintrk;
8-
((n.queue = []), (n.version = "3.0"));
9-
var t = document.createElement("script");
10-
t.async = !0;
11-
t.src = e;
12-
var r = document.getElementsByTagName("script")[0];
13-
r.parentNode.insertBefore(t, r);
14-
}
15-
})("https://s.pinimg.com/ct/core.js");
162

17-
pintrk("load", "2613717138491", {
18-
em: "b58906c504c5638798eb06151e6f49af1b0e4c6c3b5d4f30d9c2268dbe6f9d60", // example hashed email
19-
});
20-
pintrk("page");
3+
const isLocalhost = ["localhost", "127.0.0.1", "::1"].includes(
4+
window.location.hostname,
5+
);
6+
7+
if (isLocalhost) {
8+
console.log("Pinterest tracking skipped in local development");
9+
} else {
10+
!(function (e) {
11+
if (!window.pintrk) {
12+
window.pintrk = function () {
13+
window.pintrk.queue.push(Array.prototype.slice.call(arguments));
14+
};
15+
var n = window.pintrk;
16+
((n.queue = []), (n.version = "3.0"));
17+
var t = document.createElement("script");
18+
t.async = !0;
19+
t.src = e;
20+
var r = document.getElementsByTagName("script")[0];
21+
r.parentNode.insertBefore(t, r);
22+
}
23+
})("https://s.pinimg.com/ct/core.js");
24+
25+
pintrk("load", "2613717138491", {
26+
em: "b58906c504c5638798eb06151e6f49af1b0e4c6c3b5d4f30d9c2268dbe6f9d60", // example hashed email
27+
});
28+
pintrk("page");
29+
}

0 commit comments

Comments
 (0)