Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

housekeeping: update docs deps #2455

Merged
merged 4 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docs/_website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,11 @@ module.exports = {
colorMode: {
disableSwitch: true,
},
googleAnalytics: {
trackingID: 'UA-170615678-4',
anonymizeIP: true,
},
algolia : {
// This is a read-only, search-only key served directly by the front-end, managed by Algolia via their
// free DocSearch program. The key is not sensitive. See https://docsearch.algolia.com/ for more details.
apiKey: '32f1f7956b3d2c3c90fbe259c7901d94',
apiKey: 'e9fd4dc1b48bb4b9e8763d3adc9df6d1',
appId: 'XFPMTG0051',
indexName: 'lyft_clutch',
},
prism : {
Expand Down Expand Up @@ -221,6 +218,10 @@ module.exports = {
path: "generated/docs",
sidebarPath: require.resolve('../sidebars.json'),
},
googleAnalytics: {
trackingID: 'UA-170615678-4',
anonymizeIP: true,
},
blog: {
path: "generated/blog",
blogTitle: 'Clutch Open-source Developer Blog',
Expand Down
2 changes: 1 addition & 1 deletion docs/_website/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
ignore = "/bin/false"

[build.environment]
NODE_VERSION = "14"
NODE_VERSION = "16"
3 changes: 3 additions & 0 deletions docs/_website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@
"chokidar": "^3.5.1",
"react-tiny-popover": "^7.0.0",
"typescript": "^4.1.3"
},
"engines": {
"node": ">=16.0.0 <17"
}
}
3 changes: 2 additions & 1 deletion docs/_website/src/components/Share/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ interface ShareProps {
url: string;
twitter_username?: string;
}[];
style: {[key: string]: unknown}
}

const Share = ({title, authors}: ShareProps) => {
const Share = ({ title, authors, style }: ShareProps) => {
const [open, setOpen] = React.useState(false);

return (
Expand Down
28 changes: 13 additions & 15 deletions docs/_website/src/theme/BlogPostItem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import clsx from 'clsx';
import { MDXProvider } from '@mdx-js/react';
import Seo from '@theme/Seo';
import { PageMetadata } from '@docusaurus/theme-common';
// @ts-ignore
import { useBlogPost } from '@docusaurus/theme-common/internal';
import Link from '@docusaurus/Link';
import MDXComponents from '@theme/MDXComponents';
import Share from '@site/src/components/Share';
Expand All @@ -23,15 +25,11 @@ const MONTHS = [
];

function BlogPostItem(props) {
const {
children,
frontMatter,
metadata,
truncated,
isBlogPostPage = false,
} = props;
const { date, permalink, tags, readingTime } = metadata;
const { authors, title, image, keywords } = frontMatter;
const { children } = props;
const post = useBlogPost()
const isBlogPostPage = post.isBlogPostPage;
const { date, permalink, tags, readingTime, hasTruncateMarker } = post.metadata;
const { authors, title, image, keywords } = post.frontMatter;

const renderPostHeader = () => {
const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
Expand All @@ -51,7 +49,7 @@ function BlogPostItem(props) {
{month} {day}, {year}{' '}
{readingTime && <> · {Math.ceil(readingTime)} min read</>}
</time>
{!truncated && <>&nbsp;·&nbsp;<Share title={title} authors={authors} style={{margin: "0 7px"}} /></>}
{isBlogPostPage && <>&nbsp;·&nbsp;<Share title={title} authors={authors} style={{margin: "0 7px"}} /></>}
</div>


Expand Down Expand Up @@ -83,14 +81,14 @@ function BlogPostItem(props) {

return (
<MDXProvider components={{ ...MDXComponents, img: Image }}>
<Seo {...{keywords, image}} />
<PageMetadata {...{keywords, image}} />

<article className={clsx(!isBlogPostPage && 'margin-bottom--lg', !isBlogPostPage && styles.blogPostPreview)}>
{renderPostHeader()}
<section className="markdown">
{children}
</section>
{(tags.length > 0 || truncated) && (
{(tags.length > 0 || hasTruncateMarker) && (
<footer className="row margin-vert--md">
{tags.length > 0 && (
<div className="col">
Expand All @@ -104,10 +102,10 @@ function BlogPostItem(props) {
))}
</div>
)}
{truncated && (
{hasTruncateMarker && (
<div className="col text--right">
<Link
to={metadata.permalink}
to={permalink}
aria-label={`Read more about ${title}`}>
<strong>Read More</strong>
</Link>
Expand Down
6 changes: 3 additions & 3 deletions docs/_website/src/theme/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { NavbarLogo } from '@docusaurus/theme-common'
import { useThemeConfig } from '@docusaurus/theme-common';

import styles from './styles.module.css';
import { ThemeConfig } from '../types';

var socialLinks = [
{
Expand Down Expand Up @@ -139,9 +140,8 @@ function Links({ links }) {
};

function Footer() {
const context = useDocusaurusContext();
const {siteConfig = {}} = context;
const {themeConfig = {}} = siteConfig;
const { siteConfig } = useDocusaurusContext();
const themeConfig = {...siteConfig.themeConfig} as ThemeConfig;
const {footer} = themeConfig;

const {copyright, links = []} = footer || {};
Expand Down
4 changes: 3 additions & 1 deletion docs/_website/src/theme/Footer/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
}

.noGradient {
border-top: 1px solid var(--ifm-hr-border-color);
border-top: 1px solid #bec3c9;
}

.footerAdditional {
white-space: nowrap;
font-size: .9rem;
list-style: none;
padding: 0;
}

.navbarLogo {
Expand Down
66 changes: 27 additions & 39 deletions docs/_website/src/theme/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';

import ColorModeToggle from '@theme/ColorModeToggle';
import SearchBar from '@theme/SearchBar';
import Toggle from '@theme/Toggle';
import useThemeContext from '@theme/hooks/useThemeContext';
import useHideableNavbar from '@theme/hooks/useHideableNavbar';
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
import useWindowSize from '@theme/hooks/useWindowSize';
import { useColorMode, useWindowSize } from '@docusaurus/theme-common';
import type { NavLinkProps as BaseNavLinkProps } from '@docusaurus/Link';
import {
useHideableNavbar,
useLockBodyScroll,
// @ts-ignore
} from '@docusaurus/theme-common/internal';

import Logo from '@theme/Logo';

import styles from './styles.module.css';
import { ThemeConfig } from '../types';

// retrocompatible with v1
const DefaultNavItemPosition = 'right';
Expand Down Expand Up @@ -50,13 +55,13 @@ var items = [
icon: "fe fe-github",
label: 'GitHub',
},
];
] as ItemProps[];

interface NavLinkProps {
interface NavLinkProps extends BaseNavLinkProps {
to: string;
href?: string;
label: string;
activeClassName?: string;
className?: string;
prependBaseUrlToHref?: boolean;
icon: string;
}
Expand All @@ -69,7 +74,7 @@ function NavLink({
prependBaseUrlToHref = false,
icon,
...props
}) {
}: NavLinkProps) {
const toUrl = useBaseUrl(to);
const normalizedHref = useBaseUrl(href, { forcePrependBaseUrl: true });

Expand Down Expand Up @@ -129,7 +134,7 @@ function NavItem({
onClick={(e) => e.preventDefault()}
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.target.parentNode.classList.toggle('dropdown--show');
e.currentTarget.parentElement.classList.toggle('dropdown--show');
}
}}>
{props.label}
Expand Down Expand Up @@ -209,20 +214,13 @@ function splitLinks(links) {
}

function Navbar() {
const {
siteConfig: {
themeConfig: {
navbar: { hideOnScroll = false } = {},
colorMode: {disableSwitch: disableColorModeSwitch = false} = {},
},
},
isClient,
} = useDocusaurusContext();
const { siteConfig } = useDocusaurusContext();
const themeConfig = {...siteConfig.themeConfig} as ThemeConfig;
const hideOnScroll = themeConfig.navbar.hideOnScroll || false;
const disableColorModeSwitch = themeConfig.colorMode.disableSwitch || false;
const [sidebarShown, setSidebarShown] = useState(false);
const [isSearchBarExpanded, setIsSearchBarExpanded] = useState(false);

const { isDarkTheme, setLightTheme, setDarkTheme } = useThemeContext();
const { navbarRef, isNavbarVisible } = useHideableNavbar(hideOnScroll);
const { colorMode, setLightTheme, setDarkTheme } = useColorMode();

useLockBodyScroll(sidebarShown);

Expand Down Expand Up @@ -250,11 +248,9 @@ function Navbar() {

return (
<nav
ref={navbarRef}
className={clsx('navbar', 'navbar--light', 'navbar--fixed-top', styles.navbarCustom, {
className={clsx('navbar', colorMode === "light" ? 'navbar--light' : 'navbar--dark', 'navbar--fixed-top', styles.navbarCustom, {
'navbar-sidebar--show': sidebarShown,
[styles.navbarHideable]: hideOnScroll,
[styles.navbarHidden]: !isNavbarVisible,
})}>
<div className="navbar__inner">
<div className="navbar__items">
Expand Down Expand Up @@ -286,25 +282,21 @@ function Navbar() {
)}
<div className={clsx("navbar__brand", styles.navbarLogoCustom)}>
<Logo imageClassName={clsx("navbar__logo", styles.navbarLogoCustom)} />
<img className={clsx('navbar__title', styles.navbarLogoTextCustom, {[styles.hideLogoText]: isSearchBarExpanded})} src={useBaseUrl("img/navigation/logoText.svg")} />
<img className={clsx('navbar__title', styles.navbarLogoTextCustom)} src={useBaseUrl("img/navigation/logoText.svg")} />
</div>
{leftLinks.map((linkItem, i) => (
<NavItem {...linkItem} key={i} />
))}
</div>
<div className="navbar__items navbar__items--right">
<SearchBar
handleSearchBarToggle={setIsSearchBarExpanded}
isSearchBarExpanded={isSearchBarExpanded}
/>
<SearchBar />
{rightLinks.map((linkItem, i) => (
<NavItem {...linkItem} key={i} />
))}
{!disableColorModeSwitch && (
<Toggle
<ColorModeToggle
value={colorMode}
className={styles.displayOnlyInLargeViewport}
aria-label="Dark mode toggle"
checked={isDarkTheme}
onChange={onToggleChange}
/>
)}
Expand All @@ -319,14 +311,10 @@ function Navbar() {
<div className="navbar-sidebar__brand">
<div className={clsx("navbar__brand", styles.navbarLogoCustom)} onClick={hideSidebar}>
<Logo imageClassName={clsx("navbar__logo", styles.navbarLogoCustom)} />
<img className={clsx('navbar__title', styles.navbarLogoTextCustom, {[styles.hideLogoText]: isSearchBarExpanded})} src={useBaseUrl("img/navigation/logoText.svg")} />
<img className={clsx('navbar__title', styles.navbarLogoTextCustom)} src={useBaseUrl("img/navigation/logoText.svg")} />
</div>
{!disableColorModeSwitch && sidebarShown && (
<Toggle
aria-label="Dark mode toggle in sidebar"
checked={isDarkTheme}
onChange={onToggleChange}
/>
<ColorModeToggle value={colorMode} onChange={onToggleChange} />
)}
</div>
<div className="navbar-sidebar__items">
Expand Down
10 changes: 0 additions & 10 deletions docs/_website/src/theme/Navbar/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,10 @@
}
}

@media (max-width: 768px) {
.hideLogoText {
display: none;
}
}

.navbarHideable {
transition: top 0.2s ease-in-out;
}

.navbarHidden {
top: calc(var(--ifm-navbar-height) * -1) !important;
}

/* Customization */
.navbarItemIcon {
margin-right: .33rem;
Expand Down
36 changes: 36 additions & 0 deletions docs/_website/src/theme/types.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { ThemeConfig as AlgoliaThemeConfig } from '@docusaurus/theme-search-algolia';
import type { ThemeConfig as BaseThemeConfig } from '@docusaurus/preset-classic';

export interface FooterLink {
title: string;
items: {
label: string;
to: string;
}[];
}

export interface ThemeConfig extends BaseThemeConfig {
image: string;
colorMode: {
disableSwitch?: boolean;
};
algolia: AlgoliaThemeConfig;
prism: {
additionalLanguages: string[];
};
navbar: {
logo: {
alt: string;
src: string;
};
hideOnScroll?: boolean;
};
footer: {
style: 'light' | 'dark';
logo: {
src: string;
};
links: FooterLink[];
copyright: string;
}
}
5 changes: 4 additions & 1 deletion docs/_website/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "@tsconfig/docusaurus/tsconfig.json",
"include": ["src/", "."],
"include": ["src/"],
"compilerOptions": {
"baseUrl": "."
}
}
Loading