* fix: shim injectIntl hoc to prevent errors with undefined * refactor: add i18n-loader exports to i18n/index * fix: add NewRelic logging
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classNames from 'classnames';
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
import { faPencilAlt } from '@fortawesome/free-solid-svg-icons';
|
|
import { injectIntl, intlShape } from '@edx/frontend-i18n'; // eslint-disable-line
|
|
import { Button } from '@edx/paragon';
|
|
|
|
import messages from './EditButton.messages';
|
|
|
|
function EditButton({
|
|
onClick, className, style, intl,
|
|
}) {
|
|
return (
|
|
<Button
|
|
className={classNames('btn-sm btn-link', className)}
|
|
onClick={onClick}
|
|
style={style}
|
|
>
|
|
<FontAwesomeIcon className="mr-1" icon={faPencilAlt} />
|
|
{intl.formatMessage(messages['profile.editbutton.edit'])}
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
export default injectIntl(EditButton);
|
|
|
|
EditButton.propTypes = {
|
|
onClick: PropTypes.func.isRequired,
|
|
className: PropTypes.string,
|
|
style: PropTypes.object, // eslint-disable-line
|
|
|
|
// i18n
|
|
intl: intlShape.isRequired,
|
|
};
|
|
|
|
EditButton.defaultProps = {
|
|
className: null,
|
|
style: null,
|
|
};
|