diff --git a/src/components/navigation-header/components/sandbox-dropdown/__tests__/sandbox-dropdown.test.tsx b/src/components/navigation-header/components/sandbox-dropdown/__tests__/sandbox-dropdown.test.tsx index 954a923625..87f436d024 100644 --- a/src/components/navigation-header/components/sandbox-dropdown/__tests__/sandbox-dropdown.test.tsx +++ b/src/components/navigation-header/components/sandbox-dropdown/__tests__/sandbox-dropdown.test.tsx @@ -59,7 +59,7 @@ describe('SandboxDropdown', () => { // Click to open fireEvent.click(button) - expect(screen.getByText('HashiCorp Sandboxes')).toBeInTheDocument() + expect(screen.getByText('Vault Sandboxes')).toBeInTheDocument() // Click to close fireEvent.click(button) @@ -75,7 +75,7 @@ describe('SandboxDropdown', () => { // Open dropdown fireEvent.click(button) - expect(screen.getByText('HashiCorp Sandboxes')).toBeInTheDocument() + expect(screen.getByText('Vault Sandboxes')).toBeInTheDocument() // Press escape fireEvent.keyDown(button, { key: 'Escape' }) @@ -91,7 +91,7 @@ describe('SandboxDropdown', () => { // Open dropdown fireEvent.click(button) - expect(screen.getByText('HashiCorp Sandboxes')).toBeInTheDocument() + expect(screen.getByText('Vault Sandboxes')).toBeInTheDocument() // Click outside fireEvent.mouseDown(document.body) diff --git a/src/components/navigation-header/components/sandbox-dropdown/index.tsx b/src/components/navigation-header/components/sandbox-dropdown/index.tsx index 0f1573dea9..182d7d189e 100644 --- a/src/components/navigation-header/components/sandbox-dropdown/index.tsx +++ b/src/components/navigation-header/components/sandbox-dropdown/index.tsx @@ -6,7 +6,6 @@ import { KeyboardEvent, useRef, useState } from 'react' import { useId } from '@react-aria/utils' import { IconChevronDown16 } from '@hashicorp/flight-icons/svg-react/chevron-down-16' -import { IconArrowRight16 } from '@hashicorp/flight-icons/svg-react/arrow-right-16' import { useRouter } from 'next/router' import { useCurrentProduct } from 'contexts' import { useInstruqtEmbed } from 'contexts/instruqt-lab' @@ -23,6 +22,7 @@ import s from './sandbox-dropdown.module.css' import { SandboxLab } from 'types/sandbox' import { ProductSlug } from 'types/products' import { buildLabIdWithConfig } from 'lib/build-instruqt-url' +import { useTheme } from 'next-themes' interface SandboxDropdownProps { ariaLabel: string @@ -47,6 +47,8 @@ const SandboxDropdown = ({ ariaLabel, label }: SandboxDropdownProps) => { lab.products.includes(currentProduct.slug) ) + const isOnSandboxPage = router.query?.productSlug === currentProduct?.slug + // Handles closing the menu if there is a click outside of it and it is open. useOnClickOutside([menuRef], () => setIsOpen(false), isOpen) @@ -146,8 +148,23 @@ const SandboxDropdown = ({ ariaLabel, label }: SandboxDropdownProps) => { setIsOpen(false) } + const { theme, systemTheme } = useTheme() + const isLightTheme = + theme === 'light' || (theme === 'system' && systemTheme === 'light') return ( -