feat(proxies): mount tooltip portal within rootElement

This commit is contained in:
kunish 2024-10-13 01:59:03 +08:00
parent 9621001b42
commit 554b361184
No known key found for this signature in database
GPG Key ID: 67D3ACD788F3A7CD
4 changed files with 9 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import {
favNightTheme,
setCurTheme,
setLatestConnectionMsg,
setRootElement,
useTwemoji,
useWsRequest,
} from '~/signals'
@ -33,6 +34,7 @@ export const App: ParentComponent = ({ children }) => {
return (
<div
ref={(el) => setRootElement(el)}
class={twMerge(
'relative flex h-screen flex-col overscroll-y-none subpixel-antialiased',
useTwemoji() ? 'font-twemoji' : 'font-no-twemoji',

View File

@ -8,7 +8,7 @@ import {
formatProxyType,
getLatencyClassName,
} from '~/helpers'
import { curTheme, useProxies } from '~/signals'
import { rootElement, useProxies } from '~/signals'
export const ProxyNodeCard = (props: {
proxyName: string
@ -79,8 +79,8 @@ export const ProxyNodeCard = (props: {
</div>
</Tooltip.Trigger>
<Tooltip.Portal>
<Tooltip.Content data-theme={curTheme()} class="z-50 bg-transparent">
<Tooltip.Portal mount={rootElement()}>
<Tooltip.Content class="z-50">
<Tooltip.Arrow class="text-neutral" />
<div class="flex flex-col items-center gap-2 rounded-box bg-neutral p-2.5 text-neutral-content">

3
src/signals/global.ts Normal file
View File

@ -0,0 +1,3 @@
export const [rootElement, setRootElement] = createSignal(
document.createElement('div'),
)

View File

@ -1,5 +1,6 @@
export * from './config'
export * from './connections'
export * from './global'
export * from './logs'
export * from './proxies'
export * from './request'