diff --git a/ui/app/components/ui/check-box/check-box.component.js b/ui/app/components/ui/check-box/check-box.component.js
index c7ed09734..40a8e6818 100644
--- a/ui/app/components/ui/check-box/check-box.component.js
+++ b/ui/app/components/ui/check-box/check-box.component.js
@@ -1,36 +1,60 @@
-import React, { PureComponent } from 'react'
+import React, { useLayoutEffect, useRef } from 'react'
import PropTypes from 'prop-types'
import classnames from 'classnames'
-export default class CheckBox extends PureComponent {
- static propTypes = {
- className: PropTypes.string,
- checked: PropTypes.bool,
- onClick: PropTypes.func.isRequired,
- }
-
- static defaultProps = {
- className: '',
- checked: false,
- }
-
- render () {
- const { className, checked, onClick } = this.props
-
- return (
-
onClick() }
- className={classnames('check-box', className, {
- 'check-box--checked': checked,
- 'check-box--un-checked': !checked,
- })}
- >
- {
- checked
- ?
- : null
- }
-
- )
- }
+const CHECKBOX_STATE = {
+ CHECKED: 'CHECKED',
+ INDETERMINATE: 'INDETERMINATE',
+ UNCHECKED: 'UNCHECKED',
}
+
+export const { CHECKED, INDETERMINATE, UNCHECKED } = CHECKBOX_STATE
+
+const CheckBox = ({ className, disabled, onClick, checked }) => {
+ if (typeof checked === 'boolean') {
+ checked = checked
+ ? CHECKBOX_STATE.CHECKED
+ : CHECKBOX_STATE.UNCHECKED
+ }
+ const ref = useRef(null)
+ useLayoutEffect(() => {
+ ref.current.indeterminate = checked === CHECKBOX_STATE.INDETERMINATE
+ }, [checked])
+
+ return (
+ {
+ event.preventDefault()
+ onClick()
+ }
+ : null
+ }
+ readOnly
+ ref={ref}
+ type="checkbox"
+ />
+ )
+}
+
+CheckBox.propTypes = {
+ className: PropTypes.string,
+ disabled: PropTypes.bool,
+ onClick: PropTypes.func,
+ checked: PropTypes.oneOf([...Object.keys(CHECKBOX_STATE), true, false]).isRequired,
+}
+
+CheckBox.defaultProps = {
+ className: undefined,
+ disabled: false,
+}
+
+export default CheckBox
diff --git a/ui/app/components/ui/check-box/check-box.stories.js b/ui/app/components/ui/check-box/check-box.stories.js
new file mode 100644
index 000000000..5700e5179
--- /dev/null
+++ b/ui/app/components/ui/check-box/check-box.stories.js
@@ -0,0 +1,24 @@
+import React from 'react'
+import { action } from '@storybook/addon-actions'
+import CheckBox, { CHECKED, INDETERMINATE, UNCHECKED } from './check-box.component'
+import { boolean, select } from '@storybook/addon-knobs/react'
+
+export default {
+ title: 'Check Box',
+}
+
+const checkboxOptions = {
+ [CHECKED]: CHECKED,
+ [INDETERMINATE]: INDETERMINATE,
+ [UNCHECKED]: UNCHECKED,
+ True: true,
+ False: false,
+}
+
+export const primaryType = () => (
+
+)
diff --git a/ui/app/components/ui/check-box/index.js b/ui/app/components/ui/check-box/index.js
index aee60a436..fc4dfd2f8 100644
--- a/ui/app/components/ui/check-box/index.js
+++ b/ui/app/components/ui/check-box/index.js
@@ -1 +1 @@
-export { default } from './check-box.component'
+export { default, CHECKED, INDETERMINATE, UNCHECKED } from './check-box.component'
diff --git a/ui/app/components/ui/check-box/index.scss b/ui/app/components/ui/check-box/index.scss
index 90f8b77ad..bf7d9762b 100644
--- a/ui/app/components/ui/check-box/index.scss
+++ b/ui/app/components/ui/check-box/index.scss
@@ -1,26 +1,23 @@
.check-box {
- cursor: pointer;
+ -webkit-appearance: none;
+ appearance: none;
+ background: $white;
+ color: $Grey-100;
+ width: 18px;
+ height: 18px;
+ font-size: 21px;
+ line-height: 0.9;
+ border-radius: 2px;
+ display: flex;
- &--checked {
- background: $curious-blue;
- border: 2px solid $curious-blue;
- border-radius: 2px;
- width: 18px;
- height: 18px;
- display: flex;
- justify-content: center;
- align-items: center;
-
- i {
- color: $white;
- }
+ &:checked, &:indeterminate {
+ color: $curious-blue;
+ border-color: $curious-blue;
}
- &--un-checked {
- background: $white;
- border: 2px solid $Grey-100;
- border-radius: 2px;
- width: 18px;
- height: 18px;
+ &:disabled {
+ color: $Grey-100;
+ cursor: not-allowed;
+ opacity: 0.5;
}
-}
\ No newline at end of file
+}
diff --git a/ui/app/css/itcss/settings/typography.scss b/ui/app/css/itcss/settings/typography.scss
index 5e6e2b3a0..7fd8cd8f1 100644
--- a/ui/app/css/itcss/settings/typography.scss
+++ b/ui/app/css/itcss/settings/typography.scss
@@ -2,6 +2,7 @@ $fa-font-path: 'fonts/fontawesome';
@import '../../../../../node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss';
@import '../../../../../node_modules/@fortawesome/fontawesome-free/scss/solid.scss';
+@import '../../../../../node_modules/@fortawesome/fontawesome-free/scss/regular.scss';
@font-face {
font-family: 'Roboto';
diff --git a/ui/app/pages/permissions-connect/choose-account/choose-account.component.js b/ui/app/pages/permissions-connect/choose-account/choose-account.component.js
index aa1c6dc8a..8df4c8329 100644
--- a/ui/app/pages/permissions-connect/choose-account/choose-account.component.js
+++ b/ui/app/pages/permissions-connect/choose-account/choose-account.component.js
@@ -3,7 +3,7 @@ import React, { Component } from 'react'
import classnames from 'classnames'
import Identicon from '../../../components/ui/identicon'
import Button from '../../../components/ui/button'
-import CheckBox from '../../../components/ui/check-box'
+import CheckBox, { CHECKED, INDETERMINATE, UNCHECKED } from '../../../components/ui/check-box'
import Tooltip from '../../../components/ui/tooltip-v2'
import { PRIMARY } from '../../../helpers/constants/common'
import UserPreferencedCurrencyDisplay from '../../../components/app/user-preferenced-currency-display'
@@ -90,7 +90,7 @@ export default class ChooseAccount extends Component {
(this.allAreSelected() ? this.deselectAll() : this.selectAll())}
/>
{ this.context.t('selectAll') }