Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Department Level background color #198

Merged
merged 3 commits into from
Jul 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions app/src/components/PartyLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ const PartyLevel = (props) => {
completeSections,
} = props

const isComplete = status === "complete"
const isInProgress = status === "ready" || status === "in_progress"
const isLocked = !status || status === "locked" || status === null
const isComplete = status === 'complete' || (departments && departments.length === completeSections)
const isInProgress = status === 'ready' || status === 'in_progress'
const isLocked = !status || status === 'locked' || status === null
const incrOrDecr = percentChange > 0 ? 'Increased' : 'Decreased'

const partyLevelCssClass = isComplete ? 'PartyLevel--complete' : 'PartyLevel'
const imgCssClass = isLocked ? 'PartyLevel__image--unstarted' : 'PartyLevel__image'

const statusIcon = () => {
if (isComplete){
if (isComplete) {
return check
} else if (isInProgress) {
return pencil
} else {
return lock
}
} return lock
}

const progressMessage = (index) => {
const progressMessage = (i) => {
let changeText

if (percentChange === 0) {
Expand All @@ -42,16 +40,16 @@ const PartyLevel = (props) => {
changeText = `${incrOrDecr} Funding ${percentChange}%`
}

if (isComplete){
if (index === 0) return // Don't show anything for Welcome
if (isComplete) {
if (i === 0) return // Don't show anything for Welcome
return changeText
} else if (isInProgress) {
return `${completeSections || 0}/${departments.length} Complete`
}
}

const titleCssClass = () => {
if (isComplete || isInProgress){
if (isComplete || isInProgress) {
return 'PartyLevel__title'
} else {
return 'PartyLevel__title--unstarted'
Expand All @@ -65,7 +63,7 @@ const PartyLevel = (props) => {
className={imgCssClass}
/>
<div className="PartyLevel__details">
<img src={statusIcon()} alt={title} className="PartyLevel__status"/>
<img src={statusIcon()} alt={title} className="PartyLevel__status" />
<h2 className={titleCssClass()}>{title}</h2>
<span className="PartyLevel__progress">{progressMessage(index)}</span>
</div>
Expand Down
Loading