Skip to content

Commit

Permalink
remove actionbar in offline mode. update sidenav height when scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
seungpark committed Oct 22, 2024
1 parent 09442dc commit 64ff051
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import redirectBasedOnLang from './src/utils/head-scripts/redirect-based-on-lang
import { getHtmlLangFormat } from './src/utils/locale';
import bindTabUI from './src/utils/head-scripts/offline-ui/tabs';
import { isOfflineDocsBuild } from './src/utils/is-offline-docs-build';
import updateSidenavHeight from './src/utils/head-scripts/offline-ui/sidenav';

export const onRenderBody = ({ setHeadComponents, setHtmlAttributes }) => {
const headComponents = [
Expand Down Expand Up @@ -98,6 +99,16 @@ export const onRenderBody = ({ setHeadComponents, setHtmlAttributes }) => {
}}
/>
);
headComponents.push(
<script
key="offline-sidenav-ui"
type="text/javascript"
dangerouslySetInnerHTML={{
// Call function immediately on load
__html: `!${updateSidenavHeight}()`,
}}
/>
);
}
setHtmlAttributes({
// Help work with translated content locally; Smartling should handle rewriting the lang
Expand Down
3 changes: 2 additions & 1 deletion src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { theme } from '../theme/docsTheme';
import useSnootyMetadata from '../utils/use-snooty-metadata';
import { useRemoteMetadata } from '../hooks/use-remote-metadata';
import { getAllLocaleCssStrings } from '../utils/locale';
import { isOfflineDocsBuild } from '../utils/is-offline-docs-build';

// TODO: Delete this as a part of the css cleanup
// Currently used to preserve behavior and stop legacy css
Expand Down Expand Up @@ -131,7 +132,7 @@ const DefaultLayout = ({ children, data: { page }, pageContext: { slug, repoBran
<div />
)}
<StyledContentContainer>
<ActionBar template={template} slug={slug} sidenav={sidenav} />
{!isOfflineDocsBuild && <ActionBar template={template} slug={slug} sidenav={sidenav} />}
<ContentTransition slug={slug}>{children}</ContentTransition>
</StyledContentContainer>
</GlobalGrid>
Expand Down

0 comments on commit 64ff051

Please sign in to comment.