-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new ProgressTableLevelIcon component for displaying level icons…
… in the detail table header
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
apps/src/templates/sectionProgress/progressTables/ProgressTableLevelIcon.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {levelType} from '@cdo/apps/templates/progress/progressTypes'; | ||
import FontAwesome from '@cdo/apps/templates/FontAwesome'; | ||
import color from '@cdo/apps/util/color'; | ||
import * as progressStyles from '@cdo/apps/templates/progress/progressStyles'; | ||
import {getIconForLevel} from '@cdo/apps/templates/progress/progressHelpers'; | ||
|
||
const styles = { | ||
container: { | ||
...progressStyles.flex, | ||
...progressStyles.cellContent | ||
}, | ||
icon: { | ||
...progressStyles.inlineBlock, | ||
textAlign: 'center', | ||
color: color.charcoal, | ||
fontSize: 20 | ||
} | ||
}; | ||
|
||
export default class ProgressTableLevelIcon extends React.Component { | ||
static propTypes = { | ||
levels: PropTypes.arrayOf(levelType) | ||
}; | ||
|
||
render() { | ||
return ( | ||
<span style={styles.container}> | ||
{this.props.levels.map(level => { | ||
return ( | ||
<span key={`${level.id}_${level.levelNumber}`}> | ||
<span | ||
style={{ | ||
...styles.icon, | ||
width: progressStyles.BUBBLE_CONTAINER_WIDTH | ||
}} | ||
> | ||
<FontAwesome icon={getIconForLevel(level, true)} /> | ||
</span> | ||
{level.sublevels && ( | ||
<span | ||
style={{ | ||
...progressStyles.inlineBlock, | ||
width: | ||
level.sublevels.length * | ||
progressStyles.LETTER_BUBBLE_CONTAINER_WIDTH | ||
}} | ||
/> | ||
)} | ||
</span> | ||
); | ||
})} | ||
</span> | ||
); | ||
} | ||
} |