0
0
Fork 0

Convert <Button> to Typescript (#27492)

This commit is contained in:
Renaud Chaput 2023-10-23 09:43:00 +02:00 committed by GitHub
parent ab0fb81479
commit 9d45a444f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 86 additions and 118 deletions

View file

@ -10,7 +10,7 @@ import Toggle from 'react-toggle';
import { muteAccount } from '../../../actions/accounts';
import { closeModal } from '../../../actions/modal';
import { toggleHideNotifications, changeMuteDuration } from '../../../actions/mutes';
import Button from '../../../components/button';
import { Button } from '../../../components/button';
const messages = defineMessages({
minutes: { id: 'intervals.full.minutes', defaultMessage: '{number, plural, one {# minute} other {# minutes}}' },
@ -63,10 +63,6 @@ class MuteModal extends PureComponent {
onChangeMuteDuration: PropTypes.func.isRequired,
};
componentDidMount() {
this.button.focus();
}
handleClick = () => {
this.props.onClose();
this.props.onConfirm(this.props.account, this.props.notifications, this.props.muteDuration);
@ -76,10 +72,6 @@ class MuteModal extends PureComponent {
this.props.onClose();
};
setRef = (c) => {
this.button = c;
};
toggleNotifications = () => {
this.props.onToggleNotifications();
};
@ -134,7 +126,7 @@ class MuteModal extends PureComponent {
<Button onClick={this.handleCancel} className='mute-modal__cancel-button'>
<FormattedMessage id='confirmation_modal.cancel' defaultMessage='Cancel' />
</Button>
<Button onClick={this.handleClick} ref={this.setRef}>
<Button onClick={this.handleClick} autoFocus>
<FormattedMessage id='confirmations.mute.confirm' defaultMessage='Mute' />
</Button>
</div>