This commit is contained in:
@@ -33,6 +33,7 @@ export function Btn({
|
||||
children,
|
||||
variant = "primary",
|
||||
type = "button",
|
||||
size,
|
||||
disabled,
|
||||
onClick,
|
||||
style,
|
||||
@@ -40,6 +41,7 @@ export function Btn({
|
||||
children: React.ReactNode;
|
||||
variant?: "primary" | "danger" | "ghost";
|
||||
type?: "button" | "submit" | "reset";
|
||||
size?: "sm";
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
style?: React.CSSProperties;
|
||||
@@ -47,9 +49,9 @@ export function Btn({
|
||||
const base: React.CSSProperties = {
|
||||
border: "none",
|
||||
borderRadius: "var(--radius)",
|
||||
padding: "8px 16px",
|
||||
padding: size === "sm" ? "4px 10px" : "8px 16px",
|
||||
fontWeight: 600,
|
||||
fontSize: 13,
|
||||
fontSize: size === "sm" ? 12 : 13,
|
||||
cursor: disabled ? "not-allowed" : "pointer",
|
||||
opacity: disabled ? 0.6 : 1,
|
||||
};
|
||||
|
||||
@@ -301,7 +301,7 @@ function emptyProduct() {
|
||||
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>) =>
|
||||
set((prev) => ({ ...prev, [key]: e.target.value }));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export default function UsersPage() {
|
||||
|
||||
const openEdit = (user: 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("");
|
||||
setModal("edit");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user