Skip to content
Open
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
23 changes: 0 additions & 23 deletions packages/audiodocs/src/components/HandIcon/index.tsx

This file was deleted.

133 changes: 0 additions & 133 deletions packages/audiodocs/src/components/TopPromoRotator/index.tsx

This file was deleted.

This file was deleted.

81 changes: 18 additions & 63 deletions packages/audiodocs/src/theme/Navbar/index.jsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,10 @@
import { useLocation } from '@docusaurus/router';
import React from 'react';
// eslint-disable-next-line import/no-unresolved
import useBaseUrl from '@docusaurus/useBaseUrl';
import TopPromoRotator, { PROMO_VERSION } from '@site/src/components/TopPromoRotator';
import { Navbar } from '@swmansion/t-rex-ui';
import './styles.css';

export default function NavbarWrapper(props) {
const location = useLocation();
const baseUrl = useBaseUrl('/');
const isLanding = location.pathname === baseUrl;

const [showPromo, setShowPromo] = React.useState(true);

React.useEffect(() => {
if (isLanding || typeof globalThis === 'undefined') {
return;
}

try {
const raw = globalThis.localStorage?.getItem('topPromoState');
const state = raw ? JSON.parse(raw) : null;
if (state?.v === PROMO_VERSION && state?.hidden) {
setShowPromo(false);
}
} catch (_) {
// ignore
}
}, [isLanding]);

const handleClosePromo = React.useCallback(() => {
setShowPromo(false);
if (typeof globalThis !== 'undefined') {
try {
globalThis.localStorage?.setItem(
'topPromoState',
JSON.stringify({ v: PROMO_VERSION, hidden: true })
);
} catch {
// ignore
}
}
}, []);

const titleImages = {
light: useBaseUrl('/img/title.svg?v=12'),
dark: useBaseUrl('/img/title-dark.svg?v=12'),
Expand All @@ -53,30 +15,23 @@ export default function NavbarWrapper(props) {
};

return (
<div style={{ display: 'flex', flexDirection: 'column', flexShrink: 0 }}>
{isLanding ? (
<TopPromoRotator />
) : (
showPromo && <TopPromoRotator onClose={handleClosePromo} />
)}
<Navbar
useLandingLogoDualVariant={true}
heroImages={heroImages}
titleImages={titleImages}
landingItems={[
{
href: '/react-native-audio-api/docs',
label: 'Docs',
position: 'right',
'aria-label': 'Documentation',
},
]}
{...props}
>
<button type='button' className='navbar__toggle' aria-label='Toggle navigation'>
<span className='navbar__toggle-icon' />
</button>
</Navbar>
</div>
<Navbar
useLandingLogoDualVariant={true}
heroImages={heroImages}
titleImages={titleImages}
landingItems={[
{
href: '/react-native-audio-api/docs',
label: 'Docs',
position: 'right',
'aria-label': 'Documentation',
},
]}
{...props}
>
<button type='button' className='navbar__toggle' aria-label='Toggle navigation'>
<span className='navbar__toggle-icon' />
</button>
</Navbar>
);
}
Loading