Skip to content

Commit 701e196

Browse files
authored
docs: redirect users to the correct page from header button (#6779)
1 parent 774cac4 commit 701e196

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

docs/src/components/Header/Desktop.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ type Props = {
3939
className?: string;
4040
};
4141

42+
const NewLookButton = () => {
43+
const currentUrl = typeof window !== 'undefined' ? window.location.href : 'https://cube.dev/docs';
44+
const nextUrl = currentUrl.replace('cube.dev/docs', 'cube.dev/docs-next');
45+
46+
return (
47+
<Button
48+
href={nextUrl}
49+
target="_blank"
50+
className={styles.headerButton}
51+
>
52+
<Icon style={{ fontSize: '22px' }} type="bulb" />
53+
Try out the new look!
54+
</Button>
55+
);
56+
}
57+
4258
const Header: React.FC<Props> = (props) => (
4359
<Layout.Header className={props.className}>
4460
<div className={styles.searchDimmer}></div>
@@ -58,14 +74,7 @@ const Header: React.FC<Props> = (props) => (
5874
{/* Community*/}
5975
{/*</Button>*/}
6076

61-
<Button
62-
href="https://cube.dev/docs-next"
63-
target="_blank"
64-
className={styles.headerButton}
65-
>
66-
<Icon style={{ fontSize: '22px' }} type="bulb" />
67-
Try out the new look!
68-
</Button>
77+
<NewLookButton />
6978

7079
<Button
7180
href="https://slack.cube.dev/"

0 commit comments

Comments
 (0)