Skip to content

Commit 61becf8

Browse files
committed
Fix issue with search bar.
Signed-off-by: Thomas Hallgren <thomas@tada.se>
1 parent 0a1a190 commit 61becf8

File tree

16 files changed

+120
-111
lines changed

16 files changed

+120
-111
lines changed

.github/workflows/blc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
with:
1414
repository: datawire/getambassador.io-blc2
1515
path: blc
16-
- run: yarn install
16+
- run: yarn
1717
working-directory: site
18-
- run: yarn run gatsby build
18+
- run: yarn build
1919
working-directory: site
2020
- run: npm install
2121
working-directory: blc
@@ -24,7 +24,7 @@ jobs:
2424
set -o pipefail
2525
(TARGET=../site PRODUCT=telepresenceio make -C . > blc.log) || ! (grep 'has a broken' blc.log)
2626
working-directory: blc
27-
- uses: actions/upload-artifact@v2
27+
- uses: actions/upload-artifact@v4
2828
with:
2929
name: blc.log
3030
path: blc/blc.log

.github/workflows/lint.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ jobs:
66
steps:
77
- uses: actions/setup-node@v4
88
- uses: actions/checkout@v4
9-
- run: yarn install
10-
- name: "yarn run gatsby build"
9+
- run: yarn
10+
- name: "yarn build"
1111
run: |
12-
# The sed part of this command removes terminal escape codes.
13-
NODE_ENV=development yarn run gatsby build
12+
yarn build
1413
- name: "Dirty check"
1514
run: |
1615
git add .

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
/.cache/
77
/public/
88

9+
# Docusaurus
10+
/.docusaurus/
11+
/build/
12+
913
# gatsby-plugin-extract-schema
1014
/schema.graphql
1115

docusaurus.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const config: Config = {
3737
'classic',
3838
{
3939
docs: {
40-
sidebarPath: './sidebars.ts',
4140
// Please change this to your repo.
4241
// Remove this to remove the "edit this page" links.
4342
editUrl: ({docPath}) => {
@@ -47,15 +46,15 @@ const config: Config = {
4746
includeCurrentVersion: false,
4847
beforeDefaultRemarkPlugins: [remarkGithubAdmonitionsToDirectives],
4948
async sidebarItemsGenerator(args) {
50-
const { docs, version: {versionName, contentPath}} = args;
49+
const {docs, version: {versionName, contentPath}} = args;
5150
type LinkItem = {
5251
link?: string,
5352
title: string,
5453
items?: LinkItem[]
5554
}
5655
const idSet = new Set<string>(docs.map(doc => doc.id))
5756
const linkToItem = ((linkItem: LinkItem) => {
58-
if(linkItem.link) {
57+
if (linkItem.link) {
5958
idSet.delete(linkItem.link);
6059
return {
6160
type: 'doc',

sidebars.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/components/ClientOnly.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React, { useState, useEffect } from 'react'
2+
3+
function ClientOnly({ children, ...delegated }) {
4+
const [hasMounted, setHasMounted] = useState(false);
5+
6+
useEffect(() => {
7+
setHasMounted(true);
8+
}, []);
9+
if (!hasMounted) {
10+
return (<div>Loading...</div>);
11+
}
12+
return (
13+
<div {...delegated}>
14+
{children}
15+
</div>
16+
);
17+
}
18+
19+
export default ClientOnly

src/components/Platform/index.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ function Provider({children}: Props) {
6565
doAutoDetect: true,
6666
});
6767
if (!state.setTab) {
68-
console.log("Setting setState function")
6968
state.setTab = (newTab: string) => {
7069
window.history.replaceState(
7170
null,
7271
'',
7372
`?os=${newTab}${window.location.hash}`,
7473
);
75-
console.log("Setting state to " + newTab)
7674
setState({
7775
curTab: newTab,
7876
setTab: null,
@@ -85,11 +83,9 @@ function Provider({children}: Props) {
8583
const query = new URLSearchParams(window.location.search);
8684
let os = query.get('os');
8785
if (os === null) {
88-
console.log("Query for 'os' returned null")
8986
os = detectUserOS(window);
9087
}
9188
if (publicTabs().map((cls) => cls.slug).includes(os)) {
92-
console.log("OS " + os + " is included")
9389
if (state.doAutoDetect || state.curTab !== os) {
9490
setState({
9591
curTab: os,

src/components/Search.tsx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import * as React from "react";
2+
import styled from "@mui/material/styles/styled";
3+
4+
const GoogleSearch = styled('div')(() => ({
5+
table: {
6+
padding: 0,
7+
margin: 0,
8+
border: 0,
9+
},
10+
tr: {
11+
color: "var(--ifm-navbar-color)",
12+
border: 0,
13+
},
14+
td: {
15+
padding: 0,
16+
margin: 0,
17+
border: 0,
18+
lineHeight: 1.2,
19+
},
20+
'.gsc-control-cse': {
21+
padding: 0,
22+
margin: 0,
23+
},
24+
'.gsc': {
25+
backgroundColor: "var(--ifm-navbar-background-color)",
26+
borderColor: "var(--ifm-navbar-background-color)",
27+
'&-control': {
28+
'&-cse': {
29+
backgroundColor: "var(--ifm-navbar-background-color)",
30+
borderColor: "var(--ifm-navbar-background-color)",
31+
overflow: 'hidden',
32+
}
33+
},
34+
'&-input': {
35+
backgroundColor: "var(--ifm-navbar-background-color)",
36+
'.gsib_a': {
37+
padding: '5px 1px 5px 8px',
38+
},
39+
'&-box': {
40+
borderRadius: '8px',
41+
overflow: 'hidden',
42+
}
43+
},
44+
'&-search-button': {
45+
margin: '0 0',
46+
'&-v2': {
47+
padding: '7px 7px',
48+
borderRadius: '50%',
49+
},
50+
},
51+
}
52+
}));
53+
54+
// Search must be combined with a script tag in head that points to the
55+
// Google search engine declaration. Our is added in ./Root/index.tsx
56+
//
57+
// See https://programmablesearchengine.google.com/ for more info.
58+
function Search() {
59+
return (
60+
<GoogleSearch><div className="gcse-search"/></GoogleSearch>
61+
)
62+
}
63+
export default Search;

src/theme/ColorModeToggle/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default function ColorModeToggleWrapper(props: Props): JSX.Element {
1515

1616
// Whenever the theme changes in docusaurus, trigger the change in MUI
1717
useEffect(() => {
18-
console.log("setColorScheme: "+value)
1918
setMode(value);
2019
});
2120

src/theme/DocItem/Metadata/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default function MetadataWrapper(props: Props): JSX.Element {
1313
const { pathname } = useLocation();
1414
const canonical = `${customFields['canonicalBaseUrl']}${pathname}`
1515

16-
console.log("canonical: "+canonical);
1716
return (
1817
<>
1918
<Metadata {...props} />

0 commit comments

Comments
 (0)