From f94821497b504669f26283b152420fe46e9ffc80 Mon Sep 17 00:00:00 2001 From: yjl9903 Date: Thu, 3 Oct 2024 01:17:48 +0800 Subject: [PATCH] fix(web): inline a piece of javascript --- apps/frontend/web/app/layouts/{global.ts => global.js} | 8 ++++---- apps/frontend/web/app/root.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) rename apps/frontend/web/app/layouts/{global.ts => global.js} (81%) diff --git a/apps/frontend/web/app/layouts/global.ts b/apps/frontend/web/app/layouts/global.js similarity index 81% rename from apps/frontend/web/app/layouts/global.ts rename to apps/frontend/web/app/layouts/global.js index e21f82fd..688dae02 100644 --- a/apps/frontend/web/app/layouts/global.ts +++ b/apps/frontend/web/app/layouts/global.js @@ -12,16 +12,16 @@ function updateHeroLayout() { const paddingBottom = y <= MaxPaddingBottom ? MaxPaddingBottom - y : 0; const height = paddingTop + SearchHeight + paddingBottom; - const hero = document.querySelector('.hero') as HTMLElement; + const hero = document.querySelector('.hero'); if (hero) hero.style.height = height + 'px'; - const top = document.querySelector('.hero-top') as HTMLElement; + const top = document.querySelector('.hero-top'); if (top) { top.style.top = paddingTop - MaxPaddingTop + 'px'; top.classList.remove('hidden'); } - const search = document.querySelector('.hero-search') as HTMLElement; + const search = document.querySelector('.hero-search'); if (search) search.style.top = paddingTop + 'px'; - const bottom = document.querySelector('.hero-bottom') as HTMLElement; + const bottom = document.querySelector('.hero-bottom'); if (bottom) { bottom.style.top = paddingTop + SearchHeight + 'px'; bottom.style.height = paddingBottom + 'px'; diff --git a/apps/frontend/web/app/root.tsx b/apps/frontend/web/app/root.tsx index 2b506726..38ec6b0d 100644 --- a/apps/frontend/web/app/root.tsx +++ b/apps/frontend/web/app/root.tsx @@ -8,7 +8,7 @@ import './styles/main.css'; import './styles/layout.css'; import './styles/sonner.css'; -import global from '~/layouts/global?url'; +import global from '~/layouts/global.js?raw'; import { Toaster } from '~/components/ui/sonner'; export function Layout({ children }: { children: React.ReactNode }) { @@ -23,7 +23,7 @@ export function Layout({ children }: { children: React.ReactNode }) { - +