🐛 fix: popups
Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
parent
fc91b43fc7
commit
85bbf0347c
4 changed files with 14 additions and 17 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import { type Accessor, type JSX, createEffect, createSignal } from 'solid-js';
|
||||
import Popup from './Popup';
|
||||
import Popup, { type PopupProps } from './Popup';
|
||||
|
||||
type ContextMenuProps = {
|
||||
pos: Accessor<{ x: number; y: number }>;
|
||||
} & Popup.PopupProps;
|
||||
} & PopupProps;
|
||||
|
||||
function ContextMenu(props: ContextMenuProps) {
|
||||
const [pos, setPos] = createSignal({ x: 0, y: 0 });
|
||||
|
|
|
|||
|
|
@ -8,18 +8,15 @@ import type {
|
|||
} from 'solid-js';
|
||||
import { Portal } from 'solid-js/web';
|
||||
|
||||
// eslint-disable-next-line ts/no-namespace -- todo
|
||||
declare namespace Popup {
|
||||
type PopupProps = Omit<Parameters<typeof Portal>[0], 'children'> & ParentProps & {
|
||||
visible: Accessor<boolean>;
|
||||
setVisible: Setter<boolean>;
|
||||
class?: string;
|
||||
style?: JSX.CSSProperties | string;
|
||||
mount?: Node;
|
||||
};
|
||||
}
|
||||
export type PopupProps = Omit<Parameters<typeof Portal>[0], 'children'> & ParentProps & {
|
||||
visible: Accessor<boolean>;
|
||||
setVisible: Setter<boolean>;
|
||||
class?: string;
|
||||
style?: JSX.CSSProperties | string;
|
||||
mount?: Node;
|
||||
};
|
||||
|
||||
function Popup(props: Popup.PopupProps) {
|
||||
function Popup(props: PopupProps) {
|
||||
let popupRef!: HTMLDivElement;
|
||||
|
||||
function onMouseDown(e: MouseEvent) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { PlusIcon, Settings01Icon } from '@untitled-theme/icons-solid';
|
|||
import { useNavigate } from '@solidjs/router';
|
||||
import Button from '../../base/Button';
|
||||
import PlayerHead from '../../game/PlayerHead';
|
||||
import Popup from '../Popup';
|
||||
import Popup, { type PopupProps } from '../Popup';
|
||||
import useAccountController from './AddAccountModal';
|
||||
import type { MinecraftCredentials } from '~bindings';
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ function AccountComponent(props: AccountComponentProps) {
|
|||
);
|
||||
}
|
||||
|
||||
function AccountPopup(props: Popup.PopupProps) {
|
||||
function AccountPopup(props: PopupProps) {
|
||||
const controller = useAccountController();
|
||||
|
||||
const filteredAccounts = () => controller.accounts()?.filter(account => account.id !== controller.defaultAccount()?.id) ?? [];
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { For, Match, Switch } from 'solid-js';
|
||||
import { Settings01Icon, Trash01Icon } from '@untitled-theme/icons-solid';
|
||||
import { OverlayScrollbarsComponent } from 'overlayscrollbars-solid';
|
||||
import Popup from '../Popup';
|
||||
import Popup, { type PopupProps } from '../Popup';
|
||||
import Button from '../../base/Button';
|
||||
import NotificationComponent from './NotificationComponent';
|
||||
import useNotifications from '~ui/hooks/useNotifications';
|
||||
|
||||
function NotificationPopup(props: Popup.PopupProps) {
|
||||
function NotificationPopup(props: PopupProps) {
|
||||
const [notifications] = useNotifications(updateSize);
|
||||
|
||||
let inner!: HTMLDivElement;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue