This commit is contained in:
@@ -33,6 +33,7 @@ export function Btn({
|
|||||||
children,
|
children,
|
||||||
variant = "primary",
|
variant = "primary",
|
||||||
type = "button",
|
type = "button",
|
||||||
|
size,
|
||||||
disabled,
|
disabled,
|
||||||
onClick,
|
onClick,
|
||||||
style,
|
style,
|
||||||
@@ -40,6 +41,7 @@ export function Btn({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
variant?: "primary" | "danger" | "ghost";
|
variant?: "primary" | "danger" | "ghost";
|
||||||
type?: "button" | "submit" | "reset";
|
type?: "button" | "submit" | "reset";
|
||||||
|
size?: "sm";
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
@@ -47,9 +49,9 @@ export function Btn({
|
|||||||
const base: React.CSSProperties = {
|
const base: React.CSSProperties = {
|
||||||
border: "none",
|
border: "none",
|
||||||
borderRadius: "var(--radius)",
|
borderRadius: "var(--radius)",
|
||||||
padding: "8px 16px",
|
padding: size === "sm" ? "4px 10px" : "8px 16px",
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: 13,
|
fontSize: size === "sm" ? 12 : 13,
|
||||||
cursor: disabled ? "not-allowed" : "pointer",
|
cursor: disabled ? "not-allowed" : "pointer",
|
||||||
opacity: disabled ? 0.6 : 1,
|
opacity: disabled ? 0.6 : 1,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ function emptyProduct() {
|
|||||||
return { name: "", sku: "", price: "", categoryId: "", taxId: "", description: "" };
|
return { name: "", sku: "", price: "", categoryId: "", taxId: "", description: "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
function f(key: string, set: React.Dispatch<React.SetStateAction<Record<string, string>>>) {
|
function f<T extends Record<string, string>>(key: keyof T, set: React.Dispatch<React.SetStateAction<T>>) {
|
||||||
return (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) =>
|
return (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) =>
|
||||||
set((prev) => ({ ...prev, [key]: e.target.value }));
|
set((prev) => ({ ...prev, [key]: e.target.value }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export default function UsersPage() {
|
|||||||
|
|
||||||
const openEdit = (user: User) => {
|
const openEdit = (user: User) => {
|
||||||
setSelected(user);
|
setSelected(user);
|
||||||
setForm({ name: user.name, email: user.email, password: "", roleId: user.role.id });
|
setForm({ name: user.name, email: user.email, password: "", roleId: user.role.id, vendorId: user.vendor?.id ?? "" });
|
||||||
setError("");
|
setError("");
|
||||||
setModal("edit");
|
setModal("edit");
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user