Skip to content

Commit 8f5e864

Browse files
authored
Enable shortcut to toggle search (#6360)
1 parent 89e65f0 commit 8f5e864

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

website/gatsby-config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/** @type import('gatsby').GatsbyConfig */
2-
31
const SITE_URL = `https://chillicream.com`;
42

3+
/** @type import('gatsby').GatsbyConfig */
54
module.exports = {
65
siteMetadata: {
76
title: `ChilliCream GraphQL Platform`,

website/src/components/layout/header.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useDocSearchKeyboardEvents } from "@docsearch/react";
12
import { graphql, useStaticQuery } from "gatsby";
23
import { GatsbyImage } from "gatsby-plugin-image";
34
import React, {
@@ -10,12 +11,11 @@ import React, {
1011
useRef,
1112
useState,
1213
} from "react";
13-
import styled from "styled-components";
1414
import { useSelector } from "react-redux";
15+
import styled from "styled-components";
1516

16-
import { State, WorkshopsState } from "@/state";
17-
import { WorkshopNdcOslo } from "@/components/images/workshop-ndc-oslo";
1817
import { WorkshopNdcCopenhagen } from "@/components/images/workshop-ndc-copenhagen";
18+
import { WorkshopNdcOslo } from "@/components/images/workshop-ndc-oslo";
1919
import { IconContainer } from "@/components/misc/icon-container";
2020
import { Link } from "@/components/misc/link";
2121
import { SearchModal } from "@/components/misc/search-modal";
@@ -28,7 +28,7 @@ import {
2828
SiteSiteMetadataTools,
2929
} from "@/graphql-types";
3030
import { FONT_FAMILY_HEADING, THEME_COLORS } from "@/shared-style";
31-
import { useObservable } from "@/state";
31+
import { State, WorkshopsState, useObservable } from "@/state";
3232

3333
// Brands
3434
import GithubIconSvg from "@/images/brands/github.svg";
@@ -144,6 +144,12 @@ export const Header: FC = () => {
144144
};
145145
}, [showShadow$]);
146146

147+
useDocSearchKeyboardEvents({
148+
isOpen: searchOpen,
149+
onOpen: handleSearchOpen,
150+
onClose: handleSearchClose,
151+
});
152+
147153
return (
148154
<Container ref={containerRef}>
149155
<ContainerWrapper>

0 commit comments

Comments
 (0)