Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2036 from LiskHQ/1971-implement-start-voting
Implement "start voting" - Closes #1971
- Loading branch information
Showing
34 changed files
with
584 additions
and
570 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -120,7 +120,6 @@ h6 { | |
|
||
p, | ||
a, | ||
b, | ||
i, | ||
strong { | ||
font-size: var(--paragraph-font-size-l); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import styles from './checkBox.css'; | ||
import svgIcons from '../../../utils/svgIcons'; | ||
|
||
const CheckBox = ({ | ||
added, removed, id, onChange, accent, checked, className, | ||
}) => ( | ||
<label className={`${styles.checkbox} ${className} ${checked ? 'checked' : 'unchecked'}`} htmlFor={id}> | ||
<input type='checkbox' | ||
id={id} | ||
checked={!!checked} | ||
onChange={onChange} /> | ||
<span className={`${styles.checked} ${(accent || added) && styles.accent}`}> | ||
<img src={svgIcons.checkmark} /> | ||
</span> | ||
<span className={`${styles.unchecked} ${accent && styles.accent} ${removed && styles.removed}`} /> | ||
</label> | ||
); | ||
|
||
export default CheckBox; |
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,27 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import CheckBox from './index'; | ||
|
||
describe('CheckBox', () => { | ||
const props = { | ||
added: true, | ||
removed: false, | ||
onChange: () => {}, | ||
}; | ||
|
||
it('should render checkmark icon if props.checked is true', () => { | ||
const wrapper = mount(<CheckBox {...props} checked={true} />); | ||
expect(wrapper.find('img').props()).toHaveProperty('src', 'test-file-stub'); | ||
}); | ||
|
||
it('should render with "accent" class if props.accent is true', () => { | ||
const wrapper = mount(<CheckBox {...props} accent={true} />); | ||
expect(wrapper.find('.checked').hasClass('accent')).toEqual(true); | ||
}); | ||
|
||
it('should render with "removed" class if props.removed is true', () => { | ||
const wrapper = mount(<CheckBox {...props} removed={true} />); | ||
expect(wrapper.find('span.unchecked').hasClass('removed')).toEqual(true); | ||
}); | ||
}); | ||
|
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,24 @@ | ||
import React from 'react'; | ||
import styles from './tabs.css'; | ||
|
||
const Tabs = ({ | ||
tabs, active, onClick, className, | ||
}) => ( | ||
<ul className={styles.wrapper}> | ||
{tabs.map((filter, i) => ( | ||
<li key={i} | ||
className={`${className} ${filter.className} ${(active === filter.value) ? styles.active : ''}`} | ||
onClick={() => onClick(filter)}> | ||
{filter.name} | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
|
||
Tabs.defaultProps = { | ||
tabs: [], | ||
onClick: () => {}, | ||
className: '', | ||
}; | ||
|
||
export default Tabs; |
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,41 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import Tabs from './index'; | ||
|
||
describe('Tabs', () => { | ||
const props = { | ||
tabs: [{ | ||
value: 'All', | ||
}, | ||
{ | ||
value: 'Voted', | ||
}], | ||
active: 'All', | ||
}; | ||
|
||
it('should render list of length of props.tabs', () => { | ||
const wrapper = mount(<Tabs {...props} />); | ||
expect(wrapper.find('li')).toHaveLength(props.tabs.length); | ||
}); | ||
|
||
it('should render empty even if no props.tabs', () => { | ||
const wrapper = mount(<Tabs />); | ||
expect(wrapper.find('li')).toHaveLength(0); | ||
}); | ||
|
||
it('should call props.onClick when li clicked', () => { | ||
const index = 1; | ||
const onClick = jest.fn(); | ||
const wrapper = mount(<Tabs {...props} onClick={onClick} />); | ||
(wrapper.find('li').at(index)).simulate('click'); | ||
expect(onClick).toHaveBeenCalledWith(props.tabs[index]); | ||
}); | ||
|
||
it('should not fail if no props.onClick passed when li clicked', () => { | ||
const index = 1; | ||
const onClick = jest.fn(); | ||
const wrapper = mount(<Tabs {...props} />); | ||
(wrapper.find('li').at(index)).simulate('click'); | ||
expect(onClick).not.toHaveBeenCalledWith(props.tabs[index]); | ||
}); | ||
}); |
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,41 @@ | ||
@import '../../app/variablesV2.css'; | ||
@import '../../app/mixins.css'; | ||
|
||
.wrapper { | ||
border-radius: inherit; | ||
background-color: var(--color-white-smoke); | ||
display: flex; | ||
list-style: none; | ||
margin: 0; | ||
margin-left: -20px; | ||
padding: 0; | ||
|
||
& > li { | ||
@mixin contentNormal; | ||
|
||
align-items: center; | ||
border-bottom: 1px solid var(--color-platinum); | ||
border-right: 1px solid var(--color-platinum); | ||
color: var(--color-slate-gray); | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: center; | ||
margin-bottom: -2px; | ||
padding: 14px 20px; | ||
position: relative; | ||
|
||
&:first-child { | ||
border-top-left-radius: var(--border-radius-box); | ||
} | ||
|
||
&:last-child:not(.active) { | ||
border-right: 0 none; | ||
} | ||
|
||
&.active { | ||
background: var(--color-white); | ||
border-bottom: 1px solid var(--color-white); | ||
color: var(--color-ultramarine-blue); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.