Add new pages

This commit is contained in:
Darren Clarke 2022-12-02 17:45:14 +01:00
parent 95a21d6f50
commit 2b9672fedf
No known key found for this signature in database
GPG key ID: E2483E6F82907488
11 changed files with 432 additions and 66 deletions

View file

@ -0,0 +1,43 @@
import { FC, useState } from "react";
import Iframe from "react-iframe";
type ZammadWrapperProps = {
url: string;
hideSidebar?: boolean;
};
export const ZammadWrapper: FC<ZammadWrapperProps> = ({
url,
hideSidebar = true,
}) => {
const [display, setDisplay] = useState("none");
return (
<Iframe
id="link"
url={url}
width="100%"
height="100%"
frameBorder={0}
styles={{ display }}
onLoad={() => {
const linkElement = document.querySelector("iframe");
if (
linkElement.contentDocument &&
linkElement.contentDocument?.querySelector
) {
// @ts-ignore
linkElement.contentDocument.querySelector("#navigation").style =
"display: none";
if (hideSidebar) {
// @ts-ignore
linkElement.contentDocument.querySelector(".sidebar").style =
"display: none";
}
setDisplay("inherit");
}
}}
/>
);
};