@@ -2,7 +2,9 @@ import React from 'react';
22import { useSelector } from 'react-redux' ;
33import PropTypes from 'prop-types' ;
44
5- import { injectIntl , intlShape } from '@edx/frontend-platform/i18n' ;
5+ import {
6+ getLocale , injectIntl , intlShape , isRtl ,
7+ } from '@edx/frontend-platform/i18n' ;
68import { useModel } from '../../../../generic/model-store' ;
79import CurrentGradeTooltip from './CurrentGradeTooltip' ;
810import PassingGradeTooltip from './PassingGradeTooltip' ;
@@ -26,14 +28,16 @@ function GradeBar({ intl, passingGrade }) {
2628
2729 const lockedTooltipClassName = gradesFeatureIsFullyLocked ? 'locked-overlay' : '' ;
2830
31+ const adjustedRtlStyle = ( percentOffest ) => ( isRtl ( getLocale ( ) ) ? { transform : `translateX(${ 100 - percentOffest } %)` } : { } ) ;
32+
2933 return (
3034 < div className = "col-12 col-sm-6 align-self-center p-0" >
3135 < div className = "sr-only" > { intl . formatMessage ( messages . courseGradeBarAltText , { currentGrade, passingGrade } ) } </ div >
3236 < svg width = "100%" height = "100px" className = "grade-bar" aria-hidden = "true" >
3337 < g style = { { transform : 'translateY(2.61em)' } } >
3438 < rect className = "grade-bar__base" width = "100%" />
35- < rect className = "grade-bar--passing" width = { `${ passingGrade } %` } />
36- < rect className = { `grade-bar--current-${ isPassing ? 'passing' : 'non-passing' } ` } width = { `${ currentGrade } %` } />
39+ < rect className = "grade-bar--passing" width = { `${ passingGrade } %` } style = { adjustedRtlStyle ( passingGrade ) } />
40+ < rect className = { `grade-bar--current-${ isPassing ? 'passing' : 'non-passing' } ` } width = { `${ currentGrade } %` } style = { adjustedRtlStyle ( currentGrade ) } />
3741
3842 { /* Start divider */ }
3943 < rect className = "grade-bar__divider" />
0 commit comments