Skip to content

Commit

Permalink
Release/hap summit 2024 (#519)
Browse files Browse the repository at this point in the history
* tweak: colors & layout (#513)

* tweak: colors & layout

* tweak: logo

* tweak: feedback buttons

* tweak: header menus

* tweak: fonts

* tweak: some styles

* tweak: some styles

* tweak: optimize the preload of font

* tweak: disable ripple

* tweak: add placeholders

* fix: placeholders

* fix: useState when ssr

* tweak: build type

* tweak: some anchor color

* fix: header nav select status

* tweak: left nav & styles

* tweak: styles

* tweak: styles

* tweak: update learning center url & styles

* fix: some layout

* refactor: some css

* refactor: css define

* tweak: update fonts

* fix: css var

* fix: hide download pdf in tidbcloud pages

* refactor: resource urls file

* refactor: utils file

* refactor: remove styles/image

* fix: seo import

* tweak: remove header border

* tweak: footers

* tweak: header navs

* tweak: update footers

* tweak: global border radius

* tweak: border radius in mdx

* tweak: border radius for mdx tab

* fix: feedback zindex

* fix: zindex of feedback

* feat: htap ad in right nav (#518)

* feat: htap ad in right nav

* chore: BuildType

* feat: integrate with tidbai (#517)

* feat: integrate with tidbai

* fix: open tidbai

* fix: header actions gap

* chore: remove unused box

* tweak: initializing status

* tweak: header buttons

* fix: styles

* tweak: new index page of dedicated/cloud (#520)

* fix: mobile styles

* tweak: header styles

* tweak: learning path styles

* tweak: new index page banner

* tweak: tidbai icon color

* tweak: new footer logos

* fix: button colors in search

* tweak: colors & layout (#513)

* tweak: colors & layout

* tweak: logo

* tweak: feedback buttons

* tweak: header menus

* tweak: fonts

* tweak: some styles

* tweak: some styles

* tweak: optimize the preload of font

* tweak: disable ripple

* tweak: add placeholders

* fix: placeholders

* fix: useState when ssr

* tweak: build type

* tweak: some anchor color

* fix: header nav select status

* tweak: left nav & styles

* tweak: styles

* tweak: styles

* tweak: update learning center url & styles

* fix: some layout

* refactor: some css

* refactor: css define

* tweak: update fonts

* fix: css var

* fix: hide download pdf in tidbcloud pages

* refactor: resource urls file

* refactor: utils file

* refactor: remove styles/image

* fix: seo import

* tweak: remove header border

* tweak: footers

* tweak: header navs

* tweak: update footers

* tweak: global border radius

* tweak: border radius in mdx

* tweak: border radius for mdx tab

* fix: feedback zindex

* fix: zindex of feedback

* feat: htap ad in right nav (#518)

* feat: htap ad in right nav

* chore: BuildType

* feat: integrate with tidbai (#517)

* feat: integrate with tidbai

* fix: open tidbai

* fix: header actions gap

* chore: remove unused box

* tweak: initializing status

* tweak: header buttons

* fix: styles

* tweak: new index page of dedicated/cloud (#520)

* fix: mobile styles

* tweak: header styles

* tweak: learning path styles

* tweak: new index page banner

* tweak: tidbai icon color

* tweak: new footer logos

* fix: button colors in search

* refine(mdx, media): use more semantic image names (#521)

* chore(ts): update `tsconfig.json`

* tweak: hide x-logo in api page

* refine(template, mdx, images): improve styles of each home page (#522)

* chore(images): add images for doc home

* refine(styles): add doc home styles

* refine(gatsby, templates): improve doc home styles

* feat(gatsby): support the home page feedback

* feat(images): add several icons

* refine(mdx): improve icons for learning path

* refactor(mdx, theme, media): redesign the styles of the home page (#523)

* refine(styles, theme): improve global styles

* refine(feedback): adjust heading styles

* feat(images): add new icons and fix some icons

* refine(media): move home page hero graphic

* fix(mdx): fix learning path icons

* refine(theme): improve typography colors

* refactor(mdx/doc-home): redesign styles

* tweak: site title (#524)

* tweak: site title

* chore: update i18n

* refine(media, mdx/developer): improve dev guide styles (#525)

* refine(media, mdx/developer): improve dev guide intro hero styles

* refine(mdx/developer): improve dev tool card styles

* tweak: update theme color (#526)

* fix: footer icons order

* tweak: update header logo url to home page (#527)

* tweak: update header logo url to home page

* tweak: move heading anchor position to right

* tweak: update logo url

* Tweak footer (#528)

* fix: some inconsistency text

* tweak: footer order

* tweak: footer styles

* tweak: update mobile header

* refine(mdx, template, images): improve styles of global home page (#529)

* refine(theme): add button size styles

* refine(mdx/doc-home): improve styles and anchors

* refine(template, layout): adjust max width

* refine(mdx/doc-home): adjust hero graphic position

* media(images): add several icons for global home page

* feat(mdx/doc-home): support primary link button

* tweak: footer i18n

* fix: copyright (#530)

* tweak: clickable range of contributor link

* fix: blink of custom content

---------

Co-authored-by: Yuiham <[email protected]>
  • Loading branch information
shhdgit and Yuiham authored Sep 11, 2024
1 parent 1a59470 commit 284592a
Show file tree
Hide file tree
Showing 162 changed files with 2,905 additions and 1,495 deletions.
4 changes: 3 additions & 1 deletion gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "./src/styles/global.css";

import { pageView } from "./scripts/track";

export { default as wrapRootElement } from "./src/state/wrap-with-provider";
Expand All @@ -10,7 +12,7 @@ export const onClientEntry = () => {
██╔═══╝ ██║██║╚██╗██║██║ ██║██║ ██╔══██║██╔═══╝ ██║ ██║██║ ██║██║ ╚════██║
██║ ██║██║ ╚████║╚██████╔╝╚██████╗██║ ██║██║ ██████╔╝╚██████╔╝╚██████╗███████║
╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝╚══════╝
=====================================
Project : pingcap/website-docs
Build Time : ${process.env.GATSBY_DOC_BUILD_DATE}
Expand Down
12 changes: 11 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const docs = require("./docs/docs.json");

module.exports = {
siteMetadata: {
title: "PingCAP Docs",
title: "TiDB Docs",
description:
"Explore the how-to guides and references you need to use TiDB Cloud and TiDB, migrate data, and build your applications on the database.",
author: "@PingCAP",
Expand Down Expand Up @@ -105,6 +105,7 @@ module.exports = {
options: {
offsetY: `100`,
enableCustomId: true,
isIconAfterHeader: true,
},
},
{
Expand Down Expand Up @@ -192,5 +193,14 @@ module.exports = {
policy: [{ userAgent: "*", allow: "/" }],
},
},
{
resolve: "gatsby-plugin-react-svg",
options: {
rule: {
include: /src\/media/,
},
},
},
`gatsby-plugin-material-ui`,
],
};
72 changes: 56 additions & 16 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
export { default as wrapRootElement } from './src/state/wrap-with-provider'
export { default as wrapRootElement } from "./src/state/wrap-with-provider";

// https://github.com/gatsbyjs/gatsby/issues/1526
export const onPreRenderHTML = ({ getHeadComponents }) => {
if (process.env.NODE_ENV !== 'production') {
return
if (process.env.NODE_ENV !== "production") {
return;
}

getHeadComponents().forEach(el => {
if (el.type === 'style' && el.props['data-href']) {
el.type = 'link'
el.props['href'] = el.props['data-href']
el.props['rel'] = 'stylesheet'
getHeadComponents().forEach((el) => {
if (el.type === "style" && el.props["data-href"]) {
el.type = "link";
el.props["href"] = el.props["data-href"];
el.props["rel"] = "stylesheet";

delete el.props['data-href']
delete el.props['dangerouslySetInnerHTML']
delete el.props["data-href"];
delete el.props["dangerouslySetInnerHTML"];
}
})
}
});
};

// TODO: remove after we staticize everything
const script = `if (Promise == null || Promise.allSettled == null) {
Expand All @@ -25,10 +25,50 @@ const script = `if (Promise == null || Promise.allSettled == null) {
div.style = 'position: fixed; top: 0; left: 0; width: 100%;text-align:center; z-index: 9999'
div.innerText = /^\\/?zh/.exec(location.pathname) ? '当前浏览器不受支持,请使用最新版本的 Chrome、Firefox 或 Edge。' : 'Your current browser is not supported. Please use the latest version of Chrome, Firefox, or Edge.'
document.body.appendChild(div)
}`
}`;

export const onRenderBody = ({ setPostBodyComponents }) => {
export const onRenderBody = ({ setPostBodyComponents, setHeadComponents }) => {
setHeadComponents([
<link
key="moderat-bold"
rel="preload"
href="/fonts/Moderat-Bold.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>,
<link
key="moderat-light"
rel="preload"
href="/fonts/Moderat-Light.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>,
<link
key="moderat-medium"
rel="preload"
href="/fonts/Moderat-Medium.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>,
<link
key="moderat-regular"
rel="preload"
href="/fonts/Moderat-Regular.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>,
]);
setPostBodyComponents([
<script key="deprecated" dangerouslySetInnerHTML={{ __html: script }} />,
])
}
<script
key="ai-widget"
async
src="https://tidb.ai/widget.js"
data-controlled="true"
/>,
]);
};
16 changes: 11 additions & 5 deletions gatsby/create-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { resolve } from "path";
import type { CreatePagesArgs } from "gatsby";
import sig from "signale";

import { Locale, Repo, BuildType } from "../src/static/Type";
import { Locale, Repo, BuildType } from "../src/shared/interface";
import {
generateConfig,
generateUrl,
Expand All @@ -22,6 +22,8 @@ interface PageQueryData {
};
}

const DEFAULT_BUILD_TYPE: BuildType = "prod";

export const createDocs = async ({
actions: { createPage, createRedirect },
graphql,
Expand Down Expand Up @@ -117,7 +119,8 @@ export const createDocs = async ({
locale,
version: versionRecord[pathConfig.locale][pathConfig.repo][name],
},
buildType: (process.env.WEBSITE_BUILD_TYPE ?? "prod") as BuildType, // prod | archive, default is prod; archive is for archive site
buildType: (process.env.WEBSITE_BUILD_TYPE ??
DEFAULT_BUILD_TYPE) as BuildType, // prod | archive, default is prod; archive is for archive site
feature: {
banner: false,
feedback: true,
Expand Down Expand Up @@ -163,7 +166,8 @@ export const createCloudAPIReference = async ({
locale,
version: [],
},
buildType: (process.env.WEBSITE_BUILD_TYPE ?? "prod") as BuildType,
buildType: (process.env.WEBSITE_BUILD_TYPE ??
DEFAULT_BUILD_TYPE) as BuildType,
feature: {
banner: false,
},
Expand Down Expand Up @@ -263,10 +267,12 @@ export const createDocHome = async ({
locale,
version: [],
},
buildType: (process.env.WEBSITE_BUILD_TYPE ?? "prod") as BuildType,
buildType: (process.env.WEBSITE_BUILD_TYPE ??
DEFAULT_BUILD_TYPE) as BuildType,
feature: {
banner: false,
feedback: false,
feedback: true,
globalHome: true,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion gatsby/path.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Locale, Repo, PathConfig } from "../src/static/Type";
import { Locale, Repo, PathConfig } from "../src/shared/interface";
import CONFIG from "../docs/docs.json";

export function generateUrl(filename: string, config: PathConfig) {
Expand Down
2 changes: 1 addition & 1 deletion gatsby/toc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ListItem, List, Link, Paragraph, Text } from "mdast";

import { RepoNav, RepoNavLink, PathConfig } from "../src/static/Type";
import { RepoNav, RepoNavLink, PathConfig } from "../src/shared/interface";
import { generateUrl } from "./path";

export function mdxAstToToc(
Expand Down
2 changes: 1 addition & 1 deletion gatsby/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Repo, Locale } from "../src/static/Type";
import { Repo, Locale } from "../src/shared/interface";
import config from "../docs/docs.json";

export function getRepo(doc: Repo, lang: Locale) {
Expand Down
12 changes: 12 additions & 0 deletions images/docHome/cloud-billing-mauve.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions images/docHome/cloud-developer-mauve.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions images/docHome/cloud-getstarted-mauve.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions images/docHome/cloud-integrations-mauve.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 284592a

Please sign in to comment.