diff --git a/package.json b/package.json index 9cfaad1636..20133731eb 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "validate-llms-txt": "ts-node bin/validate-llms.txt.ts" }, "dependencies": { - "@ably/ui": "17.0.0", + "@ably/ui": "17.1.0", "@codesandbox/sandpack-react": "^2.20.0", "@codesandbox/sandpack-themes": "^2.0.21", "@gfx/zopfli": "^1.0.15", diff --git a/src/components/Examples/ExamplesList.tsx b/src/components/Examples/ExamplesList.tsx index 068c53dac5..7b63d6d9fb 100644 --- a/src/components/Examples/ExamplesList.tsx +++ b/src/components/Examples/ExamplesList.tsx @@ -1,17 +1,18 @@ import React from 'react'; import { examples } from '../../data/examples/'; +import Link from '../Link'; const ExamplesList: React.FC = () => { return (
{examples.map((example) => ( - {example.name} - + ))}
); diff --git a/src/components/Layout/Header.test.tsx b/src/components/Layout/Header.test.tsx index 2c070782a4..7fc0f3a681 100644 --- a/src/components/Layout/Header.test.tsx +++ b/src/components/Layout/Header.test.tsx @@ -37,6 +37,14 @@ jest.mock('./LanguageSelector', () => ({ LanguageSelector: jest.fn(() =>
LanguageSelector
), })); +jest.mock('../Link', () => { + const MockLink: React.FC<{ to: string; children: React.ReactNode; className?: string }> = ({ children }) => ( + {children} + ); + MockLink.displayName = 'MockLink'; + return MockLink; +}); + describe('Header', () => { beforeEach(() => { document.body.innerHTML = ''; diff --git a/src/components/Layout/Header.tsx b/src/components/Layout/Header.tsx index 979d45256d..929ebfc2d0 100644 --- a/src/components/Layout/Header.tsx +++ b/src/components/Layout/Header.tsx @@ -1,5 +1,5 @@ import React, { useContext } from 'react'; -import { navigate, useLocation } from '@reach/router'; +import { useLocation } from '@reach/router'; import Icon from '@ably/ui/core/Icon'; import AblyHeader from '@ably/ui/core/Header'; import { SearchBar } from '../SearchBar'; @@ -7,6 +7,7 @@ import LeftSidebar from './LeftSidebar'; import UserContext from 'src/contexts/user-context'; import ExamplesList from '../Examples/ExamplesList'; import TabMenu from '@ably/ui/core/TabMenu'; +import Link from '../Link'; type HeaderProps = { searchBar?: boolean; @@ -23,18 +24,22 @@ const Header: React.FC = ({ searchBar = true }) => { account: userContext.sessionState.account ?? { links: { dashboard: { href: '#' } } }, }; - const tabs = ['Docs', 'Examples']; - const tabLinks = ['/docs', '/examples']; + const desktopTabs = [ + + Docs + , + + Examples + , + ]; + const mobileTabs = ['Docs', 'Examples']; return ( { - navigate(tabLinks[index] ?? '#'); - }} + tabs={desktopTabs} + tabClassName="!p-0" options={{ underline: false, flexibleTabHeight: true, @@ -44,7 +49,7 @@ const Header: React.FC = ({ searchBar = true }) => { } mobileNav={ , , diff --git a/src/components/Layout/LeftSidebar.tsx b/src/components/Layout/LeftSidebar.tsx index 51f16189a9..3b6582cbca 100644 --- a/src/components/Layout/LeftSidebar.tsx +++ b/src/components/Layout/LeftSidebar.tsx @@ -228,7 +228,7 @@ const LeftSidebar = ({ inHeader = false }: LeftSidebarProps) => { 'overflow-y-auto', hasScrollbar ? 'md:pr-2' : 'md:pr-4', )} - style={sidebarAlignmentStyles} + style={!inHeader ? sidebarAlignmentStyles : {}} id={inHeader ? 'mobile-nav' : 'left-nav'} data={productNavData} {...commonAccordionOptions(null, activePage.tree[0]?.index, true, inHeader)} diff --git a/yarn.lock b/yarn.lock index 7857614c48..bb0a76ffec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,10 +7,10 @@ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== -"@ably/ui@17.0.0": - version "17.0.0" - resolved "https://registry.yarnpkg.com/@ably/ui/-/ui-17.0.0.tgz#c3dce13df783fd06d374a5312702e4b3692dbe21" - integrity sha512-y615+E62OH5EjxElUk6CR5/BRkLkE2Q/mawcxlueNWOxm0TyYVn73KO8OQGIsUumykwy1QpYad/KZqhc1jaw+w== +"@ably/ui@17.1.0": + version "17.1.0" + resolved "https://registry.yarnpkg.com/@ably/ui/-/ui-17.1.0.tgz#5c3612d37cb75668f2ef3058ad96c0bc17761ed9" + integrity sha512-tRztxGCwzJ9+9yy/1TurefoTXDjWTvTluOzsQzeZIGD6uRaF/JrA0WggtiYnFnw0FKudQN57ENvXpHpfOZunIg== dependencies: "@radix-ui/react-accordion" "^1.2.1" "@radix-ui/react-navigation-menu" "^1.2.4"