Skip to content

Commit

Permalink
[v4] docs: add pre-release banner, update version links (#4636)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Apr 13, 2021
1 parent 82f123b commit 184cab8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/docs-app/src/blueprint.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It is optimized for building complex data-dense interfaces for desktop applicati
@reactDocs Welcome

<div class="@ns-callout @ns-intent-primary @ns-icon-star">
<h4 class="@ns-heading">Blueprint v4 is currently in beta release</h4>
<h4 class="@ns-heading">Blueprint v4 is currently in pre-release</h4>

[Check out the new features and migration guides to upgrade from v3.x &rarr;](https://github.com/palantir/blueprint/wiki/Blueprint-4.0)

Expand Down
9 changes: 8 additions & 1 deletion packages/docs-app/src/components/blueprintDocs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import React from "react";

import { AnchorButton, Classes, HotkeysProvider, Tag } from "@blueprintjs/core";
import { DocsCompleteData } from "@blueprintjs/docs-data";
import { Documentation, DocumentationProps, NavMenuItemProps, NavMenuItem } from "@blueprintjs/docs-theme";
import { Banner, Documentation, DocumentationProps, NavMenuItemProps, NavMenuItem } from "@blueprintjs/docs-theme";

import { NavHeader } from "./navHeader";
import { NavIcon } from "./navIcons";
Expand Down Expand Up @@ -62,6 +62,12 @@ export class BlueprintDocs extends React.Component<BlueprintDocsProps, { themeNa
public state = { themeName: getTheme() };

public render() {
const banner = (
<Banner href="https://blueprintjs.com/docs/">
This is a pre-release version of Blueprint v4.x. Click here to view the docs for the latest stable
release (v3.x) &rarr;
</Banner>
);
const footer = (
<small className={classNames("docs-copyright", Classes.TEXT_MUTED)}>
&copy; {new Date().getFullYear()}
Expand All @@ -86,6 +92,7 @@ export class BlueprintDocs extends React.Component<BlueprintDocsProps, { themeNa
<Documentation
{...this.props}
className={this.state.themeName}
banner={banner}
footer={footer}
header={header}
navigatorExclude={isNavSection}
Expand Down
18 changes: 16 additions & 2 deletions packages/docs-app/src/components/navHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { INpmPackage } from "@documentalist/client";
import React from "react";

import { Classes, HotkeysTarget, Menu, MenuItem, NavbarHeading, Popover, Tag } from "@blueprintjs/core";
import { Classes, HotkeysTarget, Intent, Menu, MenuItem, NavbarHeading, Popover, Tag } from "@blueprintjs/core";
import { NavButton } from "@blueprintjs/docs-theme";

import { Logo } from "./logo";
Expand Down Expand Up @@ -85,7 +85,21 @@ export class NavHeader extends React.PureComponent<NavHeaderProps> {
];
const releaseItems = versions
.filter(v => +major(v) > 0)
.map(v => <MenuItem href={v === current ? "/docs" : `/docs/versions/${major(v)}`} key={v} text={v} />);
.map(v => {
let href;
let intent: Intent | undefined;
// pre-release versions are not served as the default docs, they are inside the /versions/ folder
if (this.props.useNextVersion) {
const isLatestStableMajor = +major(v) === +major(current) - 1;
href = isLatestStableMajor ? "/docs" : `/docs/versions/${major(v)}`;
if (isLatestStableMajor) {
intent = "primary";
}
} else {
href = v === current ? "/docs" : `/docs/versions/${major(v)}`;
}
return <MenuItem href={href} intent={intent} key={v} text={v} />;
});
return (
<Popover content={<Menu className="docs-version-list">{releaseItems}</Menu>} placement="bottom">
<Tag interactive={true} minimal={true} round={true} rightIcon="caret-down">
Expand Down

1 comment on commit 184cab8

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[v4] docs: add pre-release banner, update version links (#4636)

Previews: documentation | landing | table

Please sign in to comment.