-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor PM-407: Outcome components (#245)
Refactor: PM-407 Outcome Components
- Loading branch information
1 parent
9e9212e
commit 3e0402d
Showing
21 changed files
with
374 additions
and
294 deletions.
There are no files selected for viewing
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
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
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
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
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
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
39 changes: 39 additions & 0 deletions
39
src/components/Outcome/OutcomeCategorical/TrendingOutcomeCategorical/index.js
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,39 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import cn from 'classnames' | ||
|
||
import OutcomeColorBox from 'components/OutcomeColorBox' | ||
import style from '../outcomeCategorical.scss' | ||
|
||
const cx = cn.bind(style) | ||
|
||
const TrendingOutcomeCategorical = ({ | ||
entryStyle, outcome, percentage, resolutionDate, | ||
}) => ( | ||
<div className={cx('trendingOutcomeCategoricalContainer')}> | ||
<div className={cx('outcomeWrapper')}> | ||
<OutcomeColorBox style={entryStyle} /> | ||
<div className={cx('outcome')}>{outcome}</div> | ||
</div> | ||
<div>{percentage}%</div> | ||
<div className={cx('date')}>{resolutionDate}</div> | ||
</div> | ||
) | ||
|
||
TrendingOutcomeCategorical.propTypes = { | ||
entryStyle: PropTypes.shape({ | ||
backgroundColor: PropTypes.string, | ||
}), | ||
outcome: PropTypes.string, | ||
percentage: PropTypes.string, | ||
resolutionDate: PropTypes.string, | ||
} | ||
|
||
TrendingOutcomeCategorical.defaultProps = { | ||
entryStyle: {}, | ||
outcome: '', | ||
percentage: '', | ||
resolutionDate: '', | ||
} | ||
|
||
export default TrendingOutcomeCategorical |
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
69 changes: 69 additions & 0 deletions
69
src/components/Outcome/OutcomeCategorical/outcomeCategorical.scss
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,69 @@ | ||
@import '../../../scss/vars.scss'; | ||
|
||
$outcome-bar-height: 15px; | ||
$outcome-bar-height-leading: 30px; | ||
|
||
.outcome { | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
max-width: 100%; | ||
} | ||
|
||
.outcomeWrapper { | ||
max-width: 75%; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.outcomeBar { | ||
display: inline-block; | ||
position: relative; | ||
width: 30%; | ||
margin: 5px 0; | ||
} | ||
|
||
.outcomeBarInner { | ||
height: $outcome-bar-height; | ||
position: relative; | ||
border-top-right-radius: 5px; | ||
border-bottom-right-radius: 5px; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
|
||
transition: width 1s ease; | ||
} | ||
|
||
.outcomeBarValue { | ||
line-height: $outcome-bar-height; | ||
vertical-align: middle; | ||
padding-left: 5px; | ||
display: inline; | ||
min-width: 30px; | ||
color: $font-color-muted; | ||
font-size: 10px; | ||
letter-spacing: 0.5px; | ||
text-transform: uppercase; | ||
} | ||
|
||
.outcomeBarLabel { | ||
margin-left: 100%; | ||
padding-left: 5px; | ||
line-height: $outcome-bar-height; | ||
text-transform: uppercase; | ||
font-size: 10px; | ||
letter-spacing: 0.5px; | ||
} | ||
|
||
.outcomeLabel { | ||
display: inline-block; | ||
} | ||
|
||
.date { | ||
margin-left: 7px; | ||
} | ||
|
||
.trendingOutcomeCategoricalContainer { | ||
display: flex; | ||
align-items: center; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/components/Outcome/OutcomeScalar/TredingOutcomeScalar/index.js
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,26 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import DecimalValue from 'components/DecimalValue' | ||
|
||
const TrendingOutcomeScalar = ({ predictedValue, unit, decimals }) => ( | ||
<div className="row"> | ||
<div className="col-md-6"> | ||
<DecimalValue value={predictedValue} decimals={decimals} className="outcome__currentPrediction--value" /> | ||
{unit} | ||
</div> | ||
</div> | ||
) | ||
|
||
TrendingOutcomeScalar.propTypes = { | ||
predictedValue: PropTypes.string, | ||
unit: PropTypes.string, | ||
decimals: PropTypes.string, | ||
} | ||
|
||
TrendingOutcomeScalar.defaultProps = { | ||
predictedValue: '0', | ||
unit: '', | ||
decimals: '0', | ||
} | ||
|
||
export default TrendingOutcomeScalar |
Oops, something went wrong.