Skip to content

Commit

Permalink
Update version banner (#1431)
Browse files Browse the repository at this point in the history
* Add version banner to latest version, update link

* Fix CSS for version banner

* Fix CSS for js api version banner
  • Loading branch information
heitortsergent authored Dec 6, 2023
1 parent bb58293 commit b46e15f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
12 changes: 8 additions & 4 deletions src/components/shared/version-banner/version-banner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Link } from 'gatsby';
import React from 'react';
import { LATEST_VERSION } from 'utils/versioning';

Expand All @@ -9,14 +8,19 @@ export const VersionBanner = ({ version, versions }) => (
<div className={'container'}>
<div className={styles.inner}>
<span className={styles.message}>
⚠️ This is archived documentation for <b>{version}</b>.
⚠️ This is the archived documentation for k6 <b>{version}</b>.
{typeof versions[LATEST_VERSION] !== 'undefined' && (
<span>
{' '}
Go to the{' '}
<Link className={'link'} to={versions[LATEST_VERSION].path}>
<a
href="https://grafana.com/docs/k6/latest/"
target="_blank"
rel="noreferrer"
>
latest version
</Link>
</a>
.
</span>
)}
</span>
Expand Down
5 changes: 1 addition & 4 deletions src/layouts/doc-layout/doc-layout.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
import { childrenToList, isInIFrame } from 'utils';
import AlgoliaQueries from 'utils/algolia';
import { main, app } from 'utils/urls';
import { LATEST_VERSION } from 'utils/versioning';

import styles from './doc-layout.module.scss';
import ArrowLeft from './svg/arrow-left.inline.svg';
Expand Down Expand Up @@ -420,9 +419,7 @@ export const DocLayout = ({
</div>
</div>
</Header>
{version && version !== LATEST_VERSION && (
<VersionBanner version={version} versions={pageVersions} />
)}
{version && <VersionBanner version={version} versions={pageVersions} />}

{children}
<MobileNav
Expand Down
2 changes: 1 addition & 1 deletion src/templates/docs/javascript-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const JavascriptAPI = ({
description={
'The list of k6 modules natively supported in your k6 scripts.'
}
className={classNames(version !== LATEST_VERSION && jsApiStyles.info)}
className={classNames(jsApiStyles.info)}
/>
<div className={docPageContent.inner}>
<div ref={contentContainerRef} className={stickyContainerClasses}>
Expand Down

0 comments on commit b46e15f

Please sign in to comment.