[MM-54817] Convert ./components/admin_console/user_grid/user_grid_remove.tsx from Class Component to Function Component (#24912)
* chore: migrate user_grid_remove to fun. component * Update webapp/channels/src/components/admin_console/user_grid/user_grid_remove.tsx Co-authored-by: Daniel Espino García <larkox@gmail.com> * chore: minor linting fix --------- Co-authored-by: Daniel Espino García <larkox@gmail.com> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7ff635cfb1
Коммит
ea23423e2a
@@ -12,21 +12,22 @@ type Props = {
|
|||||||
isDisabled?: boolean;
|
isDisabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class UserGridRemove extends React.PureComponent<Props> {
|
const UserGridRemove = ({
|
||||||
private handleClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
|
user,
|
||||||
|
removeUser,
|
||||||
|
isDisabled,
|
||||||
|
}: Props) => {
|
||||||
|
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (this.props.isDisabled) {
|
if (!isDisabled) {
|
||||||
return;
|
removeUser(user);
|
||||||
}
|
}
|
||||||
this.props.removeUser(this.props.user);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public render = (): JSX.Element => {
|
|
||||||
const {isDisabled} = this.props;
|
|
||||||
return (
|
return (
|
||||||
<div className='UserGrid_removeRow'>
|
<div className='UserGrid_removeRow'>
|
||||||
<a
|
<a
|
||||||
onClick={this.handleClick}
|
onClick={handleClick}
|
||||||
href='#'
|
href='#'
|
||||||
role='button'
|
role='button'
|
||||||
className={isDisabled ? 'disabled' : ''}
|
className={isDisabled ? 'disabled' : ''}
|
||||||
@@ -38,5 +39,6 @@ export default class UserGridRemove extends React.PureComponent<Props> {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
export default UserGridRemove;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user