Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pieti kinnunen/nav update #403

Merged
merged 6 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion components/DropdownMenu/DropdownMenu.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
.body {
box-sizing: border-box;
display: block;
padding: 0 0 var(--m-2);
}

.withSubMenus {
Expand Down
57 changes: 0 additions & 57 deletions components/Header/HeaderCTA.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,60 +33,3 @@
margin-right: var(--m-2);
}
}

.downloadsLink {
text-decoration: none;
font-weight: 700;
font-size: var(--fs-text-md);
color: var(--color-code);
padding-left: 10px;
padding-right: 10px;
@media (--lg-scr) {
padding-left: var(--m-3);
padding-right: var(--m-3);
}
@media (--sm-scr) {
display: none;
}
&:focus,
&:hover {
color: var(--color-dark-purple);
}
}

.searchWrapper {
padding: var(--m-1) var(--m-1) 0 var(--m-2);
@media (--sm-scr) {
display: none;
}
}

.group {
position: relative;
padding-left: var(--m-2);
@media (--sm-scr) {
padding-left: 0;
width: 100%;
}
}

.dropdown {
display: none;
z-index: 3000;

@media (--sm-scr) {
position: relative;
width: 100%;
}

@media (--md-scr) {
position: absolute;
top: var(--m-6);
right: var(--m-2);
min-width: 400px;
}

&.visible {
display: block;
}
}
94 changes: 19 additions & 75 deletions components/Header/HeaderCTA.tsx
Original file line number Diff line number Diff line change
@@ -1,83 +1,27 @@
import cn from "classnames";
import { useState, useCallback, useRef, MouseEvent } from "react";
import { useClickAway } from "react-use";
import Button from "components/Button";
import Link from "components/Link";
import {
DropdownMenuOverlay,
DropdownMenuCTA,
DropdownMenuItemCTA,
} from "../DropdownMenu";
import styles from "./HeaderCTA.module.css";

const HeaderCTA = () => {
const ref = useRef(null);

const [isSignInVisible, setIsSignInVisible] = useState<boolean>(false);
const toggleSignIn = useCallback((e: MouseEvent<HTMLElement>) => {
e.preventDefault();

setIsSignInVisible((value) => !value);
}, []);

useClickAway(ref, () => {
if (isSignInVisible) {
setIsSignInVisible(false);
}
});

return (
<>
{isSignInVisible && <DropdownMenuOverlay />}
<div className={styles.wrapper}>
<Link
className={styles.downloadsLink}
href="https://goteleport.com/download/"
data-testid="downloads"
>
Downloads
</Link>
<div className={styles.group} ref={ref}>
<Button
as="link"
href="https://teleport.sh/"
onClick={toggleSignIn}
variant="secondary"
className={styles.cta}
data-testid="sign-in"
>
Sign In
</Button>
<div
className={cn(styles.dropdown, isSignInVisible && styles.visible)}
data-testid="sign-in-menu"
>
<DropdownMenuCTA title="Sign in to Teleport">
<DropdownMenuItemCTA
href="https://teleport.sh/"
icon="clouds"
title="Teleport Cloud Login"
description="Login to your Teleport Account"
/>
<DropdownMenuItemCTA
href="https://dashboard.gravitational.com/web/login/"
icon="download"
title="Dashboard Login"
description="Legacy Login &amp; Teleport Enterprise Downloads"
/>
</DropdownMenuCTA>
</div>
</div>
<Button
as="link"
href="/signup/"
className={styles.cta}
data-testid="get-started"
>
Get Started
</Button>
</div>
</>
<div className={styles.wrapper}>
<Button
as="link"
href="/signup/"
className={styles.cta}
data-testid="get-started"
>
Get Started
</Button>
<Button
as="link"
href="/signup/enterprise/"
variant="secondary"
className={styles.cta}
data-testid="contact-sales"
>
Contact Sales
</Button>
</div>
);
};

Expand Down
2 changes: 1 addition & 1 deletion components/Menu/Category.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
align-items: center;
justify-content: center;
z-index: 3001;
width: 100%;
white-space: nowrap;
min-width: 0;
height: 80px;
padding: 0 var(--m-2);
Expand Down
1 change: 1 addition & 0 deletions components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styles from "./Menu.module.css";

const Menu = () => {
const [openedCategoryId, setOpenedCategoryId] = useState<number | null>(null);

return (
<nav className={styles.navItems}>
{structure.map((props, id) => (
Expand Down
36 changes: 36 additions & 0 deletions components/Menu/structure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,42 @@ const menu: MenuCategoryProps[] = [
href: "/pricing/",
testId: "pricing",
},
{
title: "Community",
href: "/community/",
testId: "community",
children: [
{
title: "Getting Started with OSS",
href: "/docs/",
},
{
title: "Downloads",
href: "/download/",
},
{
title: "Community Slack",
href: "/community-slack/",
},
{
title: "GitHub",
href: "https://github.com/gravitational/teleport/",
},
{
title: "GitHub Discussions",
href: "https://github.com/gravitational/teleport/discussions",
},
{
title: "Podcasts",
href: "/resources/podcast/",
},
],
},
{
title: "Sign In",
href: "https://teleport.sh/",
testId: "sign-in",
},
];

export default menu;
49 changes: 31 additions & 18 deletions tests/data/navbar-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,37 +300,50 @@ export const navigationData: NavbarData = [
isExternal: true,
},
{
button: { title: "", testId: "search" },
href: "https://goteleport.com/search/",
isExternal: true,
},
{
button: { title: "Downloads", testId: "downloads" },
href: "https://goteleport.com/download/",
isExternal: true,
},
{
button: { title: "Sign In", testId: "sign-in" },
button: { title: "Community", testId: "community" },
menu: {
title: "Sign in to Teleport",
testId: "sign-in-menu",
title: "Community",
testId: "community-menu",
children: [
{
title: "Teleport Cloud Login",
href: "https://teleport.sh/",
isExternal: true,
title: "Getting Started with OSS",
href: "/docs/",
},
{
title: "Downloads",
href: "/download/",
},
{
title: "Community Slack",
href: "/community-slack/",
},
{
title: "Dashboard Login",
href: "https://dashboard.gravitational.com/web/login/",
title: "GitHub",
href: "https://github.com/gravitational/teleport/",
isExternal: true,
},
{
title: "GitHub Discussions",
href: "https://github.com/gravitational/teleport/discussions",
},
{
title: "Podcasts",
href: "/resources/podcast/",
},
],
},
},
{
button: { title: "Sign In", testId: "sign-in" },
href: "https://teleport.sh/",
},
{
button: { title: "Get Started", testId: "get-started" },
href: "/signup/",
isExternal: true,
},
{
button: { title: "Contact Sales", testId: "contact-sales" },
href: "/signup/enterprise/",
},
];
Loading