Skip to content

Commit

Permalink
docs: redirect users to the correct page from header button (#6779)
Browse files Browse the repository at this point in the history
  • Loading branch information
hassankhan committed Jul 3, 2023
1 parent 774cac4 commit 701e196
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions docs/src/components/Header/Desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ type Props = {
className?: string;
};

const NewLookButton = () => {
const currentUrl = typeof window !== 'undefined' ? window.location.href : 'https://cube.dev/docs';
const nextUrl = currentUrl.replace('cube.dev/docs', 'cube.dev/docs-next');

return (
<Button
href={nextUrl}
target="_blank"
className={styles.headerButton}
>
<Icon style={{ fontSize: '22px' }} type="bulb" />
Try out the new look!
</Button>
);
}

const Header: React.FC<Props> = (props) => (
<Layout.Header className={props.className}>
<div className={styles.searchDimmer}></div>
Expand All @@ -58,14 +74,7 @@ const Header: React.FC<Props> = (props) => (
{/* Community*/}
{/*</Button>*/}

<Button
href="https://cube.dev/docs-next"
target="_blank"
className={styles.headerButton}
>
<Icon style={{ fontSize: '22px' }} type="bulb" />
Try out the new look!
</Button>
<NewLookButton />

<Button
href="https://slack.cube.dev/"
Expand Down

0 comments on commit 701e196

Please sign in to comment.