fix
This commit is contained in:
parent
06712d6c7a
commit
72c85b75d0
|
|
@ -135,7 +135,7 @@ export const FieldInput: FC<{
|
|||
{prefix && prefix !== "" ? (
|
||||
<div
|
||||
className={cx(
|
||||
"c-px-2 c-flex c-flex-row c-items-center",
|
||||
"c-pl-2 c-flex c-flex-row c-items-center",
|
||||
css`
|
||||
color: gray;
|
||||
`
|
||||
|
|
@ -199,7 +199,7 @@ export const FieldInput: FC<{
|
|||
{suffix && suffix !== "" ? (
|
||||
<div
|
||||
className={cx(
|
||||
"c-px-2 c-flex c-flex-row c-items-center",
|
||||
"c-pr-2 c-flex c-flex-row c-items-center",
|
||||
css`
|
||||
color: gray;
|
||||
`
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ import { useLocal } from "lib/utils/use-local";
|
|||
import { FC, HTMLProps } from "react";
|
||||
|
||||
navigate;
|
||||
export const NavLink: FC<
|
||||
HTMLProps<HTMLAnchorElement> & {
|
||||
export const NavLink: FC<{
|
||||
className?: string;
|
||||
href?: string;
|
||||
children?: any;
|
||||
back_title?: string;
|
||||
params?: {
|
||||
name?: string;
|
||||
where?: any;
|
||||
|
|
@ -12,8 +15,7 @@ export const NavLink: FC<
|
|||
update?: any;
|
||||
breads?: { label: string; url?: string }[];
|
||||
};
|
||||
}
|
||||
> = (props) => {
|
||||
}> = (props) => {
|
||||
const local = useLocal({ loading: false });
|
||||
let href = props.href || "";
|
||||
|
||||
|
|
@ -42,13 +44,26 @@ export const NavLink: FC<
|
|||
setTimeout(() => {
|
||||
local.loading = false;
|
||||
}, 3000);
|
||||
} else if (props.back_title) {
|
||||
local.loading = true;
|
||||
local.render();
|
||||
navigate(props.href, { breads: [{ label: props.back_title }] });
|
||||
setTimeout(() => {
|
||||
local.loading = false;
|
||||
}, 3000);
|
||||
} else {
|
||||
navigate(props.href);
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
{local.loading ? <Spinner /> : props.children}
|
||||
{local.loading ? (
|
||||
<div className="c-flex c-flex-1 c-items-center c-justify-center c-w-full c-h-full">
|
||||
<Spinner />
|
||||
</div>
|
||||
) : (
|
||||
props.children
|
||||
)}
|
||||
</a>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue