Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Navigation updates, Code Security name change#5395

Merged
bretthayes merged 20 commits intomainfrom
navigation-updates
Jun 2, 2022
Merged

Navigation updates, Code Security name change#5395
bretthayes merged 20 commits intomainfrom
navigation-updates

Conversation

@zlonko
Copy link
Contributor

@zlonko zlonko commented May 25, 2022

This closes #5266. It updates navigation in the header to expose use cases and reflect the renamed Code Security page. Links are also updated to support Code Security and the removal of the Product Specialist page, a.k.a. "Become One".

Specs are located in this doc.

Changelog

  • Restructured the desktop and mobile dropdowns for "Customers" in Header
    • Renamed dropdown to "Use Cases"
    • Removed links to /use-cases and /product-specialist
    • Added links for the five use case pages
  • Flipped order of "Case Studies" and "Use Cases" in Footer
  • Deleted product-specialist.tsx per specs
    • Added redirect from /contact/product-specialist to /demo
    • Changed in-repo links to this page to demo
  • Updated "Fixing Vulnerabilities" to "Code Security"
    • Renamed vulnerabilities.tsx to code-security.tsx
    • Updated meta on code-security.tsx
    • Changed in-repo links and added redirect from /use-cases/vulnerabilities to /use-cases/code-security
    • Updated anchor link on /use-cases

Bug Fixes

Notes

  • Re: Linking the Use Case dropdown header to /use-cases
    • react-bootstrap doesn't appear to support adding an href on NavDropdown: docs

    • This also seems to pose a usability issue: a user could click the header wanting to expand the menu, but end up following the link (or vice versa). Also, a user may not expect this behavior, because neither the Product nor Resource dropdowns will repeat this pattern. Perhaps it is more declarative to have another nested item for "All Use Cases"? For example:

      Screen Shot 2022-05-25 at 5 03 37 PM

Test

  1. Ensure linting passes.
  2. Ensure prettier has standardized the proposed changes.
  3. Ensure dev and production builds work.
  4. Please check that the nav links under the "Use Case" dropdown work as expected on mobile and desktop
  5. Navigate to /use-cases/code-security successfully
  6. Check that anchor links on /use-cases are intact
  7. Please test redirects for /product-specialist and /use-cases/vulnerabilities

@zlonko zlonko added this to the A - Sprint 5 milestone May 25, 2022
@zlonko zlonko self-assigned this May 25, 2022
@zlonko zlonko changed the title Navigation updates Navigation updates, Code Security name change May 25, 2022
@zlonko zlonko marked this pull request as ready for review May 25, 2022 23:03
@zlonko zlonko requested review from bretthayes and st0nebreaker May 25, 2022 23:03
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented May 25, 2022

Notifying subscribers in CODENOTIFY files for diff 035cc5e...74a99c8.

Notify File(s)
@content-platform-team netlify.toml
src/components/Actions/ContactPresalesSupportAction.tsx
src/components/Blog/ReleasePost.tsx
src/components/Layout/Footer.tsx
src/components/Layout/Header.tsx
src/components/Layout/Header/DesktopNav.tsx
src/components/Layout/Header/MobileNav.tsx
src/components/Layout/Header/index.tsx
src/components/Layout/Header/navLinks.ts
src/components/Layout/index.tsx
src/pages/batch-changes.tsx
src/pages/case-studies/nutanix-fixed-log4j-with-sourcegraph.tsx
src/pages/contact/index.tsx
src/pages/contact/product-specialist.tsx
src/pages/home/_UseCases.tsx
src/pages/pricing.tsx
src/pages/use-cases/code-reuse.tsx
src/pages/use-cases/code-security.tsx
src/pages/use-cases/index.tsx
src/styles/components/_Header.scss

Copy link
Contributor

@st0nebreaker st0nebreaker left a comment

Choose a reason for hiding this comment

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

This is great, Tim, thanks for the enhancements along the way. 😄

  • Can you merge main back into this branch so the staging job will run? I can't test the re-directs until then, but they look like they should be good.

  • I don't have perms to view the doc to see all the requirements. So I can't double check requirements met yet.

  • Maybe a Product concern, but I feel like Case Studies being intermixed with the Use Cases drop down is a bit unorganized, right? I think Tailwind allows us to use Multi-level Dropdowns to clean this up: Tailwind-Dropdowns, Tailwind-Multilevel-Dropdowns

image

  • And a few small comments below

@zlonko
Copy link
Contributor Author

zlonko commented May 26, 2022

@st0nebraker: The merge conflict must have happened after I requested you! I am sorry for the mix-up, it is resolved now and staging should run. I also added you/CPT to the doc and meta files.

@st0nebreaker
Copy link
Contributor

@st0nebraker: The merge conflict must have happened after I requested you! I am sorry for the mix-up, it is resolved now and staging should run. I also added you/CPT to the doc and meta files.

All good! The staging job wasn't running in the workflow for some reason. The new commit triggered it though 👍 I see the re-directs working perfectly 😎

Copy link
Contributor

@bretthayes bretthayes left a comment

Choose a reason for hiding this comment

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

Looks good so far and the links work!

I'd like to make a suggestion as a refactor to make it more convenient for us to test and update these links in the future. I think we could create a nested data structure for our links and then we could add some mapping logic to render and reduce the amount of repeated markup.

Here's what I'm thinking:

const links = {
    product: [
        {
            title: 'Code Search',
            href: '/code-search'
        },
    ],
    resources: [
        {
            title: 'Code Intelligence',
            href: 'https://docs.sourcegraph.com/code_intelligence'
        },
        // ...etc.
    ],
    // ...etc.
}

Then you can use Object.keys in links to generate your IDs, react keys in your iterators, and your title attributes. This will also allow us to not have duplicate data and markup and we can render our desktop and mobile nav with the same data as the source of truth.

zlonko and others added 2 commits May 31, 2022 14:31
Co-authored-by: Brett Hayes <bretthayes@users.noreply.github.com>
Copy link
Contributor

@bretthayes bretthayes left a comment

Choose a reason for hiding this comment

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

Awesome improvements Tim! ✨ Feel free to either follow up or refactor a bit more in this PR 🙂

Comment on lines 160 to 173
item.href.includes('http') ? (
<Nav.Link
key={camelCase(item.title)}
href={item.href}
target="_blank"
rel="noreferrer"
>
{item.title}
</Nav.Link>
) : (
<Nav.Link key={camelCase(item.title)} href={item.href}>
{item.title}
</Nav.Link>
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could make this a reusable rendering function since I see this used a few times. That could reduce our logic even further. You could pass a prop to render as a different element as well.

Comment on lines 244 to 371
>
Docs
</a>
</li>
<li className="nav-item" role="presentation">
<a className="nav-link" href="https://sourcegraph.com/sign-in">
Sign in
</a>
</li>
{!props.hideGetStartedButton && (
<li className="header__nav-item nav-item" role="presentation">
<a className="nav-link" href="https://sourcegraph.com/search">
<li className="align-items-center nav-item" role="presentation">
<a
className="nav-link"
href="https://sourcegraph.com/search"
data-button-style={buttonStyle.text}
data-button-location={buttonLocation.nav}
data-button-type="cta"
>
Search code
</a>
</li>
)}
<li className="header__nav-item nav-item" role="presentation">
<li className="align-items-center nav-item" role="presentation">
<Link href="/demo" passHref={true}>
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a className="nav-link">Request a demo</a>
<a
className="nav-link"
data-button-style={buttonStyle.text}
data-button-location={buttonLocation.nav}
data-button-type="cta"
>
Request a demo
</a>
</Link>
</li>
{!props.hideGetStartedButton && (
<li className="header__nav-item nav-item" role="presentation">
<li className="align-items-center nav-item" role="presentation">
<Link href="/get-started" passHref={true}>
<a href="#none" className="nav-link">
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<a
className="nav-link"
data-button-style={buttonStyle.text}
data-button-location={buttonLocation.nav}
data-button-type="cta"
>
Get started
</a>
</Link>
Copy link
Contributor

Choose a reason for hiding this comment

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

We could even reduce the markup here as well by creating a rightNavLinks array

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! I agree 100%.

@zlonko
Copy link
Contributor Author

zlonko commented Jun 1, 2022

@bretthayes I introduced the two components here: 59c8ef8. Also, you make good points about additional optimizations, so I created #5416 for me to loop back in when I return from PTO!

bretthayes
bretthayes previously approved these changes Jun 1, 2022
Copy link
Contributor

@bretthayes bretthayes left a comment

Choose a reason for hiding this comment

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

Looks good Tim! Looking forward to some more refactoring here ✨

Copy link
Contributor

@st0nebreaker st0nebreaker left a comment

Choose a reason for hiding this comment

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

Lgtm! I think some other navbar enhancements worth considering for us is (1) To limit expanded navbar items on mobile. (2) Highlight the current page in the navbar
image

@bretthayes bretthayes merged commit 22819c5 into main Jun 2, 2022
@bretthayes bretthayes deleted the navigation-updates branch June 2, 2022 17:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Navigation updates: main nav, footer & vulnerabilities page

4 participants