From 537ac3fbc98b530e88c536b89519f05e0570e1c3 Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Sat, 3 Feb 2024 13:11:33 +0300 Subject: [PATCH] fix: logo text --- src/layout/JsonCrackLogo/index.tsx | 7 ++++++- src/lib/utils/widget.ts | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/layout/JsonCrackLogo/index.tsx b/src/layout/JsonCrackLogo/index.tsx index 5b07b45..4d6dfcb 100644 --- a/src/layout/JsonCrackLogo/index.tsx +++ b/src/layout/JsonCrackLogo/index.tsx @@ -20,9 +20,14 @@ interface LogoProps extends React.ComponentPropsWithoutRef<"a"> { } export const JSONCrackLogo: React.FC = ({ fontSize = "1.2rem", ...props }) => { + const logoText = React.useMemo(() => { + if (typeof window === "undefined") return "JSON CRACK"; + return isIframe() ? "JC" : "JSON CRACK"; + }, []); + return ( - {isIframe() ? "JC" : "JSON CRACK"} + {logoText} ); }; diff --git a/src/lib/utils/widget.ts b/src/lib/utils/widget.ts index 6e6d61b..3e336b6 100644 --- a/src/lib/utils/widget.ts +++ b/src/lib/utils/widget.ts @@ -1,6 +1,5 @@ export function isIframe() { try { - if (window === undefined) return false; return window.self !== window.top; } catch (e) { return true;