feat: modules and module-editor pages
This commit is contained in:
@ -19,6 +19,7 @@ type Props = {
|
||||
otherActions?: ActionData[];
|
||||
dotsForMobile?: boolean;
|
||||
style?: CSSProperties;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
const UpdateDeleteTableActions: FC<Props> = ({
|
||||
@ -27,6 +28,7 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
otherActions,
|
||||
style,
|
||||
dotsForMobile = false,
|
||||
disabled = false,
|
||||
}) => {
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
@ -45,6 +47,7 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
onClick={onChange}
|
||||
icon={<IconEdit />}
|
||||
label={"Редактировать"}
|
||||
disabled={disabled}
|
||||
/>
|
||||
{otherActions?.map(
|
||||
action =>
|
||||
@ -54,6 +57,7 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
icon={action.icon}
|
||||
label={action.label}
|
||||
key={action.label}
|
||||
disabled={disabled}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
@ -61,6 +65,7 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
onClick={onDelete}
|
||||
icon={<IconTrash />}
|
||||
label={"Удалить"}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</Menu.Dropdown>
|
||||
</Menu>
|
||||
@ -76,6 +81,7 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
e.stopPropagation();
|
||||
onChange();
|
||||
}}
|
||||
disabled={disabled}
|
||||
tipLabel={"Редактировать"}>
|
||||
<IconEdit />
|
||||
</ActionIconWithTip>
|
||||
@ -87,6 +93,7 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
e.stopPropagation();
|
||||
action.onClick();
|
||||
}}
|
||||
disabled={disabled}
|
||||
key={action.label}
|
||||
tipLabel={action.label}>
|
||||
{action.icon}
|
||||
@ -99,6 +106,7 @@ const UpdateDeleteTableActions: FC<Props> = ({
|
||||
e.stopPropagation();
|
||||
onDelete();
|
||||
}}
|
||||
disabled={disabled}
|
||||
tipLabel={"Удалить"}>
|
||||
<IconTrash />
|
||||
</ActionIconWithTip>
|
||||
|
||||
@ -5,16 +5,25 @@ type Props = {
|
||||
onClick: MouseEventHandler<HTMLButtonElement>;
|
||||
icon: ReactNode;
|
||||
label: string;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
const DropdownMenuItem: FC<Props> = ({ icon, label, onClick }) => {
|
||||
const DropdownMenuItem: FC<Props> = ({
|
||||
icon,
|
||||
label,
|
||||
onClick,
|
||||
disabled = false,
|
||||
}) => {
|
||||
const onClickWrapper: MouseEventHandler<HTMLButtonElement> = e => {
|
||||
e.stopPropagation();
|
||||
if (disabled) return;
|
||||
onClick(e);
|
||||
};
|
||||
|
||||
return (
|
||||
<Menu.Item onClick={onClickWrapper}>
|
||||
<Menu.Item
|
||||
onClick={onClickWrapper}
|
||||
disabled={disabled}>
|
||||
<Group wrap={"nowrap"}>
|
||||
{icon}
|
||||
<Text>{label}</Text>
|
||||
|
||||
Reference in New Issue
Block a user