Skip to content

Commit

Permalink
fix: hide on logo when used in an iframe (#2193)
Browse files Browse the repository at this point in the history
* fix: hide on logo when used in an iframe

* fix: build check

* fix: build check

* fix: build check

* fix: build check

* fix: build check

---------

Co-authored-by: Damián Parrino <bucanero@users.noreply.github.com>
  • Loading branch information
matiasbenary and bucanero authored Aug 1, 2024
1 parent a0a62ff commit 8939d68
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions website/src/theme/Navbar/Logo/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from 'react';
import Logo from '@theme/Logo';
import BrowserOnly from '@docusaurus/BrowserOnly';
import useIsBrowser from '@docusaurus/useIsBrowser';

export default function NavbarLogo() {

const isBrowser = useIsBrowser();
// if embedded in an iframe, do not show the logo
<BrowserOnly>
{() => { if (window.location !== window.parent.location) return null; }}
</BrowserOnly>
if (isBrowser && typeof window !== 'undefined' && window.self !== window.top) return null;

return (
<Logo
Expand Down

0 comments on commit 8939d68

Please sign in to comment.