change toast position

This commit is contained in:
rizky 2024-08-14 07:57:59 -07:00
parent 9261600dc0
commit a489c489c9
4 changed files with 11 additions and 11 deletions

View File

@ -8,6 +8,7 @@ import { formInit } from "./utils/init";
import { formReload } from "./utils/reload";
import { getPathname } from "lib/utils/pathname";
import { sofDeleteField as softDeleteField } from "lib/utils/soft-del-rel";
import { toast } from "../ui/toast";
const editorFormWidth = {} as Record<string, { w: number; f: any }>;
@ -82,7 +83,6 @@ export const Form: FC<FMProps> = (props) => {
fm.soft_delete.field = null;
}
}
}, []);
const ref = useRef({
@ -196,7 +196,8 @@ export const Form: FC<FMProps> = (props) => {
"form c-flex-1 c-w-full c-h-full c-relative c-overflow-auto"
)}
>
{toaster_el && createPortal(<Toaster cn={cx} />, toaster_el)}
{toaster_el &&
createPortal(<Toaster position={toast.position} cn={cx} />, toaster_el)}
<div
ref={form_inner_ref}
className={cx(

View File

@ -17,7 +17,6 @@ import {
MouseEvent,
ReactElement,
ReactNode,
useCallback,
useEffect,
} from "react";
import DataGrid, {
@ -37,7 +36,6 @@ import { MDLocal } from "../md/utils/typings";
import { Skeleton } from "../ui/skeleton";
import { toast } from "../ui/toast";
import { sortTree } from "./utils/sort-tree";
import { getPathname } from "lib/exports";
type OnRowClick = (arg: {
row: any;
@ -781,7 +779,11 @@ export const TableList: FC<TableListProp> = ({
</div>
)}
<div className="table-list-inner c-absolute c-inset-0">
{toaster_el && createPortal(<Toaster cn={cn} />, toaster_el)}
{toaster_el &&
createPortal(
<Toaster position={toast.position} cn={cn} />,
toaster_el
)}
{local.status === "init" ? (
<DataGrid
style={{ opacity: 0 }}

View File

@ -7,6 +7,7 @@ const timer = {
};
export const toast = {
position: "top-right" as any,
dismiss: () => {
if (!timer.timeout) {
sonner.dismiss();

View File

@ -1,10 +1,6 @@
import { getPathname } from "lib/utils/pathname";
import { FC, ReactNode, useEffect, useLayoutEffect, useState } from "react";
import { loadSession } from "../login/utils/load";
import { createPortal } from "react-dom";
import { Toaster } from "sonner";
import { PFTypes } from "./typings";
import { useLocal } from "lib/utils/use-local";
import { FC, useEffect } from "react";
import { PFTypes } from "./typings";
export { PFTypes } from "./typings";
export { generateProfile } from "./utils/generate";
export const Profile: FC<PFTypes> = ({