-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DUOS-1787][risk=no] vote summary header style (#1551)
* Add borders around boxes * Change vote summary label font * Add elipses when text overflows box on a single line * Add tooltip with full label * Replace icons for different vote summary states * Adjust position and appearance of icons * Adjust margin around vote summary header * Move function for determining result into VoteResultIcon * Move function for creating propKey into VoteResultLabel * Replace VoteResultContainer with VoteResultLabel in DataUseVoteSummary * Update tests * Rename file * Rename finalVotes to votes in ResultVoteBox and ResultVoteLabel * Adjust review-page-body placement * Update descriptive text for test * Add id and data-for props to fix duplicate tooltips on chair tab Co-authored-by: Shae Marks <[email protected]>
- Loading branch information
Showing
10 changed files
with
164 additions
and
308 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
11 changes: 5 additions & 6 deletions
11
...aUseVoteSummary/vote_result_label.spec.js → ...ataUseVoteSummary/vote_result_box.spec.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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
/* eslint-disable no-undef */ | ||
import React from 'react'; | ||
import { mount } from '@cypress/react'; | ||
import VoteResultIcon from '../../../src/components/common/DataUseVoteSummary/VoteResultLabel'; | ||
import VoteResultIcon from '../../../src/components/common/DataUseVoteSummary/VoteResultBox'; | ||
|
||
const propKey = 'test'; | ||
const propKey = 'Test-Label'; | ||
const label = 'Test Label'; | ||
const additionalLabelStyle = {}; | ||
|
||
describe('VoteResultLabel - Tests', function () { | ||
describe('VoteResultBox - Tests', function () { | ||
it('Renders the label with key and inner text assigned by props', function() { | ||
mount(<VoteResultIcon propKey={propKey} label={label} additinoalLabelStyle = {additionalLabelStyle}/>); | ||
const testElement = cy.get(`.vote-result-label-text-${propKey}`); | ||
mount(<VoteResultIcon label={label} additinoalLabelStyle = {additionalLabelStyle}/>); | ||
const testElement = cy.get(`.vote-result-box-text-${propKey}`); | ||
testElement.should('exist'); | ||
testElement.contains('Test Label'); | ||
testElement.should('have.attr', 'class', `vote-result-label-text-${propKey}`); | ||
}); | ||
}); |
68 changes: 0 additions & 68 deletions
68
cypress/component/DataUseVoteSummary/vote_result_container.spec.js
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {div, h, span} from 'react-hyperscript-helpers'; | ||
import VoteResultIcon from "./VoteResultIcon"; | ||
|
||
const labelContainerStyle = { | ||
display: 'flex', | ||
padding: '4px 10px', | ||
backgroundColor: '#F3F5F8', | ||
textAlign: 'center', | ||
alignItems: 'center', | ||
justifyContent: 'space-between', | ||
width: '10%' | ||
}; | ||
|
||
const labelFontStyle = { | ||
fontFamily: 'Montserrat', | ||
fontSize: '1.4rem', | ||
fontWeight: 600, | ||
whiteSpace: 'nowrap', | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis' | ||
}; | ||
|
||
//helper function to generate keys for rendered elements | ||
const convertLabelToKey = (label) => { | ||
return label.split(' ').join('-'); | ||
}; | ||
|
||
export default function VoteResultBox({ label, votes, additionalLabelStyle = {} }) { | ||
const propKey = convertLabelToKey(label); | ||
return div( | ||
{ | ||
style: Object.assign({}, labelContainerStyle, additionalLabelStyle), | ||
className: `vote-result-box-text-${propKey}`, | ||
key: `vote-result-box-${propKey}`, | ||
'data-tip': label, | ||
'data-for': 'vote-result' | ||
}, | ||
[ | ||
span({style: labelFontStyle}, [label]), | ||
h(VoteResultIcon, { propKey, votes }) | ||
] | ||
); | ||
} |
67 changes: 0 additions & 67 deletions
67
src/components/common/DataUseVoteSummary/VoteResultContainer.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.