mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-02-15 01:02:23 +00:00
embedded url parameter to hide navbar
This commit is contained in:
parent
5200a73472
commit
d745c1f97f
@ -1,5 +1,5 @@
|
|||||||
import { useAuth } from "../Auth"
|
import { useAuth } from "../Auth"
|
||||||
import { Link } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import QuestionMarkIcon from '@heroicons/react/24/outline/QuestionMarkCircleIcon'
|
import QuestionMarkIcon from '@heroicons/react/24/outline/QuestionMarkCircleIcon'
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
@ -31,6 +31,16 @@ export default function NavBar({ appName}: { appName: string }) {
|
|||||||
nameRef && setNameWidth(nameRef.current.scrollWidth)
|
nameRef && setNameWidth(nameRef.current.scrollWidth)
|
||||||
}, [nameRef, appName])
|
}, [nameRef, appName])
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
const [showNav, setShowNav] = useState<boolean>(true)
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let params = new URLSearchParams(location.search);
|
||||||
|
let embedded = params.get("embedded");
|
||||||
|
embedded=="true" && setShowNav(false)
|
||||||
|
}, [location]);
|
||||||
|
|
||||||
|
|
||||||
const onLogout = () => {
|
const onLogout = () => {
|
||||||
@ -53,7 +63,7 @@ export default function NavBar({ appName}: { appName: string }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
if(showNav) return (
|
||||||
<>
|
<>
|
||||||
<div className="tw-navbar tw-bg-base-100 tw-z-[10000] tw-shadow-xl tw-relative">
|
<div className="tw-navbar tw-bg-base-100 tw-z-[10000] tw-shadow-xl tw-relative">
|
||||||
<button className="tw-btn tw-btn-square tw-btn-ghost"
|
<button className="tw-btn tw-btn-square tw-btn-ghost"
|
||||||
@ -125,4 +135,5 @@ export default function NavBar({ appName}: { appName: string }) {
|
|||||||
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
else return (<></>)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user