Merge pull request #7889 from KDSBrowne/issue-7846

Fix layout in feedback modal (RTL)
This commit is contained in:
Anton Georgiev 2019-08-06 09:50:35 -04:00 committed by GitHub
commit e26cb1c9e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
import { defineMessages, injectIntl } from 'react-intl';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import { styles } from './styles';
const intlMessages = defineMessages({
@ -15,6 +15,12 @@ const intlMessages = defineMessages({
},
});
const propTypes = {
intl: intlShape.isRequired,
onRate: PropTypes.func.isRequired,
total: PropTypes.string.isRequired,
};
class Rating extends Component {
constructor(props) {
super(props);
@ -27,7 +33,8 @@ class Rating extends Component {
}
clickStar(e) {
this.props.onRate(e);
const { onRate } = this.props;
onRate(e);
}
renderStars(num) {
@ -54,9 +61,8 @@ class Rating extends Component {
<label
htmlFor={`${i + 1}star`}
key={_.uniqueId('star-')}
>
{`${i + 1} ${intl.formatMessage(intlMessages.starLabel)}`}
</label>
aria-label={`${i + 1} ${intl.formatMessage(intlMessages.starLabel)}`}
/>
),
]).reverse()
}
@ -80,3 +86,5 @@ class Rating extends Component {
}
export default injectIntl(Rating);
Rating.propTypes = propTypes;