mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-14 18:35:34 +08:00
feat(proxies): mount tooltip portal within rootElement
This commit is contained in:
parent
9621001b42
commit
554b361184
@ -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',
|
||||
|
@ -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
3
src/signals/global.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const [rootElement, setRootElement] = createSignal(
|
||||
document.createElement('div'),
|
||||
)
|
@ -1,5 +1,6 @@
|
||||
export * from './config'
|
||||
export * from './connections'
|
||||
export * from './global'
|
||||
export * from './logs'
|
||||
export * from './proxies'
|
||||
export * from './request'
|
||||
|
Loading…
Reference in New Issue
Block a user