diff --git a/www/src/components/navigation.js b/www/src/components/navigation.js index 1b9acf8ef3867..e60df420ed1b1 100644 --- a/www/src/components/navigation.js +++ b/www/src/components/navigation.js @@ -3,6 +3,7 @@ import Link from "gatsby-link" import GithubIcon from "react-icons/lib/go/mark-github" import TwitterIcon from "react-icons/lib/fa/twitter" +import SearchForm from "../components/search-form" import DiscordIcon from "../components/discord" import logo from "../gatsby-negative.svg" import typography, { rhythm, scale } from "../utils/typography" @@ -117,8 +118,9 @@ export default ({ pathname }) => { {

Gatsby @@ -150,10 +152,15 @@ export default ({ pathname }) => { css={{ display: `none`, [presets.Tablet]: { - display: `block`, + display: `flex`, margin: 0, padding: 0, listStyle: `none`, + flexGrow: 1, + overflowX: `auto`, + maskImage: `linear-gradient(to right, transparent, white ${rhythm( + 1 / 8 + )}, white 98%, transparent)`, }, }} > @@ -165,12 +172,13 @@ export default ({ pathname }) => {
+ {!isHomepage && ( + + )} + + + ) : null + } +} + +SearchForm.propTypes = { + styles: PropTypes.object, +} + +export default SearchForm diff --git a/www/src/components/sidebar-body.js b/www/src/components/sidebar-body.js index 9473a55767c06..70a0d493bd691 100644 --- a/www/src/components/sidebar-body.js +++ b/www/src/components/sidebar-body.js @@ -189,6 +189,7 @@ class SidebarBody extends React.Component { css={{ padding: isInline ? 0 : rhythm(3 / 4), }} + className="docSearch-sidebar" > {menu.map((section, index) => (
+ {css} @@ -80,6 +81,7 @@ export default class HTML extends React.Component { dangerouslySetInnerHTML={{ __html: this.props.body }} /> {this.props.postBodyComponents} + ) diff --git a/www/src/layouts/index.js b/www/src/layouts/index.js index 815660de7ff4e..6e82243b004d4 100644 --- a/www/src/layouts/index.js +++ b/www/src/layouts/index.js @@ -30,6 +30,7 @@ class DefaultLayout extends React.Component { this.props.location.pathname.slice(0, 10) === `/packages/` || this.props.location.pathname.slice(0, 10) === `/tutorial/` || this.props.location.pathname.slice(0, 9) === `/features` + const isSearchSource = hasSidebar const sidebarStyles = { borderRight: `1px solid ${colors.b[0]}`, backgroundColor: presets.sidebar, @@ -45,7 +46,6 @@ class DefaultLayout extends React.Component { position: `fixed`, top: `calc(${presets.headerHeight} - 1px)`, overflowY: `auto`, - zIndex: 1, height: `calc(100vh - ${presets.headerHeight} + 1px)`, WebkitOverflowScrolling: `touch`, "::-webkit-scrollbar": { @@ -136,6 +136,7 @@ class DefaultLayout extends React.Component { paddingLeft: hasSidebar ? rhythm(12) : 0, }, }} + className={isSearchSource && `docSearch-content`} > {this.props.children()}
diff --git a/www/static/search.svg b/www/static/search.svg new file mode 100644 index 0000000000000..b9faa8c07133e --- /dev/null +++ b/www/static/search.svg @@ -0,0 +1,4 @@ + + + +