Rework Button component to pass its label via children content

This commit is contained in:
ErickSkrauch
2020-07-22 14:20:10 +03:00
parent 993d0cdedb
commit d84497ac28
17 changed files with 175 additions and 152 deletions

View File

@@ -7,7 +7,6 @@ import mfaStyles from './mfa.scss';
const messages = defineMessages({
codePlaceholder: 'Enter the code here',
disable: 'Disable',
});
export default class MfaDisableForm extends React.Component<{
@@ -49,7 +48,9 @@ export default class MfaDisableForm extends React.Component<{
</div>
</div>
<Button type="submit" color="green" block label={messages.disable} />
<Button type="submit" color="green" block>
<Message key="disable" defaultMessage="Disable" />
</Button>
</Form>
);
}

View File

@@ -1,4 +1,6 @@
import React from 'react';
import { FormattedMessage as Message, defineMessages } from 'react-intl';
import { Button, FormModel } from 'app/components/ui/form';
import styles from 'app/components/profile/profileForm.scss';
import Stepper from 'app/components/ui/stepper';
@@ -7,7 +9,6 @@ import { ScrollIntoView } from 'app/components/ui/scroll';
import logger from 'app/services/logger';
import { getSecret, enable as enableMFA } from 'app/services/api/mfa';
import { Form } from 'app/components/ui/form';
import { defineMessages } from 'react-intl';
import Context from '../Context';
import Instructions from './instructions';
@@ -105,7 +106,9 @@ export default class MfaEnable extends React.PureComponent<Props, State> {
{this.renderStepForms()}
<Button color="green" onClick={buttonAction} loading={isLoading} block label={buttonLabel} />
<Button color="green" onClick={buttonAction} loading={isLoading} block>
<Message {...buttonLabel} />
</Button>
</div>
</div>
);