[Glitch] Convert <Button> to Typescript

Port 9d45a444f9 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Renaud Chaput
2023-10-23 09:43:00 +02:00
committed by Claire
parent 1138d44c7d
commit 9325cb5759
26 changed files with 88 additions and 131 deletions

View File

@@ -3,7 +3,7 @@ import { PureComponent } from 'react';
import { injectIntl, FormattedMessage } from 'react-intl';
import Button from 'flavours/glitch/components/button';
import { Button } from 'flavours/glitch/components/button';
class ConfirmationModal extends PureComponent {
@@ -23,10 +23,6 @@ class ConfirmationModal extends PureComponent {
closeWhenConfirm: true,
};
componentDidMount() {
this.button.focus();
}
handleClick = () => {
if (this.props.closeWhenConfirm) {
this.props.onClose();
@@ -46,10 +42,6 @@ class ConfirmationModal extends PureComponent {
this.props.onClose();
};
setRef = (c) => {
this.button = c;
};
setDoNotAskRef = (c) => {
this.doNotAskCheckbox = c;
};
@@ -79,7 +71,7 @@ class ConfirmationModal extends PureComponent {
{secondary !== undefined && (
<Button text={secondary} onClick={this.handleSecondary} className='confirmation-modal__secondary-button' />
)}
<Button text={confirm} onClick={this.handleClick} ref={this.setRef} />
<Button text={confirm} onClick={this.handleClick} autoFocus />
</div>
</div>
</div>