fix
This commit is contained in:
parent
06712d6c7a
commit
72c85b75d0
|
|
@ -135,7 +135,7 @@ export const FieldInput: FC<{
|
||||||
{prefix && prefix !== "" ? (
|
{prefix && prefix !== "" ? (
|
||||||
<div
|
<div
|
||||||
className={cx(
|
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`
|
css`
|
||||||
color: gray;
|
color: gray;
|
||||||
`
|
`
|
||||||
|
|
@ -199,7 +199,7 @@ export const FieldInput: FC<{
|
||||||
{suffix && suffix !== "" ? (
|
{suffix && suffix !== "" ? (
|
||||||
<div
|
<div
|
||||||
className={cx(
|
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`
|
css`
|
||||||
color: gray;
|
color: gray;
|
||||||
`
|
`
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,19 @@ import { useLocal } from "lib/utils/use-local";
|
||||||
import { FC, HTMLProps } from "react";
|
import { FC, HTMLProps } from "react";
|
||||||
|
|
||||||
navigate;
|
navigate;
|
||||||
export const NavLink: FC<
|
export const NavLink: FC<{
|
||||||
HTMLProps<HTMLAnchorElement> & {
|
className?: string;
|
||||||
params?: {
|
href?: string;
|
||||||
name?: string;
|
children?: any;
|
||||||
where?: any;
|
back_title?: string;
|
||||||
create?: any;
|
params?: {
|
||||||
update?: any;
|
name?: string;
|
||||||
breads?: { label: string; url?: string }[];
|
where?: any;
|
||||||
};
|
create?: any;
|
||||||
}
|
update?: any;
|
||||||
> = (props) => {
|
breads?: { label: string; url?: string }[];
|
||||||
|
};
|
||||||
|
}> = (props) => {
|
||||||
const local = useLocal({ loading: false });
|
const local = useLocal({ loading: false });
|
||||||
let href = props.href || "";
|
let href = props.href || "";
|
||||||
|
|
||||||
|
|
@ -42,13 +44,26 @@ export const NavLink: FC<
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
local.loading = false;
|
local.loading = false;
|
||||||
}, 3000);
|
}, 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 {
|
} else {
|
||||||
navigate(props.href);
|
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>
|
</a>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue