Browse Source

Rename CheckBox to Switch

master
Gaëtan Renaudeau 7 years ago
parent
commit
536f061625
  1. 4
      src/components/AdvancedOptions/BitcoinKind.js
  2. 6
      src/components/Onboarding/steps/Analytics.js
  3. 4
      src/components/SettingsPage/DevModeButton.js
  4. 4
      src/components/SettingsPage/DisablePasswordButton.js
  5. 4
      src/components/SettingsPage/SentryLogsButton.js
  6. 4
      src/components/SettingsPage/ShareAnalyticsButton.js
  7. 6
      src/components/base/Switch/index.js
  8. 6
      src/components/base/Switch/stories.js
  9. 2
      src/components/modals/ReleaseNotes.js

4
src/components/AdvancedOptions/BitcoinKind.js

@ -3,7 +3,7 @@ import React from 'react'
import { translate } from 'react-i18next' import { translate } from 'react-i18next'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import CheckBox from 'components/base/CheckBox' import Switch from 'components/base/Switch'
import Label from 'components/base/Label' import Label from 'components/base/Label'
import LabelInfoTooltip from 'components/base/LabelInfoTooltip' import LabelInfoTooltip from 'components/base/LabelInfoTooltip'
import Spoiler from 'components/base/Spoiler' import Spoiler from 'components/base/Spoiler'
@ -24,7 +24,7 @@ export default translate()(({ isRBF, onChangeRBF, t }: Props) => (
</Label> </Label>
</Box> </Box>
<Box grow> <Box grow>
<CheckBox isChecked={isRBF} onChange={onChangeRBF} /> <Switch isChecked={isRBF} onChange={onChangeRBF} />
</Box> </Box>
</Box> </Box>

6
src/components/Onboarding/steps/Analytics.js

@ -5,7 +5,7 @@ import styled from 'styled-components'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { saveSettings } from 'actions/settings' import { saveSettings } from 'actions/settings'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import CheckBox from 'components/base/CheckBox' import Switch from 'components/base/Switch'
import TrackPage from 'analytics/TrackPage' import TrackPage from 'analytics/TrackPage'
import Track from 'analytics/Track' import Track from 'analytics/Track'
import { Title, Description, FixedTopContainer, StepContainerInner } from '../helperComponents' import { Title, Description, FixedTopContainer, StepContainerInner } from '../helperComponents'
@ -77,7 +77,7 @@ class Analytics extends PureComponent<StepProps, State> {
: 'Sentry Logs Disabled Onboarding' : 'Sentry Logs Disabled Onboarding'
} }
/> />
<CheckBox isChecked={sentryLogsToggle} onChange={this.handleSentryLogsToggle} /> <Switch isChecked={sentryLogsToggle} onChange={this.handleSentryLogsToggle} />
</Box> </Box>
</Container> </Container>
<Container> <Container>
@ -94,7 +94,7 @@ class Analytics extends PureComponent<StepProps, State> {
: 'Analytics Disabled Onboarding' : 'Analytics Disabled Onboarding'
} }
/> />
<CheckBox isChecked={analyticsToggle} onChange={this.handleAnalyticsToggle} /> <Switch isChecked={analyticsToggle} onChange={this.handleAnalyticsToggle} />
</Box> </Box>
</Container> </Container>
</Box> </Box>

4
src/components/SettingsPage/DevModeButton.js

@ -6,7 +6,7 @@ import { createStructuredSelector } from 'reselect'
import { setDeveloperMode } from 'actions/settings' import { setDeveloperMode } from 'actions/settings'
import { developerModeSelector } from 'reducers/settings' import { developerModeSelector } from 'reducers/settings'
import Track from 'analytics/Track' import Track from 'analytics/Track'
import CheckBox from 'components/base/CheckBox' import Switch from 'components/base/Switch'
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
developerMode: developerModeSelector, developerMode: developerModeSelector,
@ -27,7 +27,7 @@ class DevModeButton extends PureComponent<Props> {
return ( return (
<Fragment> <Fragment>
<Track onUpdate event={developerMode ? 'DevModeEnabled' : 'DevModeDisabled'} /> <Track onUpdate event={developerMode ? 'DevModeEnabled' : 'DevModeDisabled'} />
<CheckBox isChecked={developerMode} onChange={setDeveloperMode} /> <Switch isChecked={developerMode} onChange={setDeveloperMode} />
</Fragment> </Fragment>
) )
} }

4
src/components/SettingsPage/DisablePasswordButton.js

@ -13,7 +13,7 @@ import { storeSelector } from 'reducers/settings'
import type { SettingsState } from 'reducers/settings' import type { SettingsState } from 'reducers/settings'
import { unlock } from 'reducers/application' // FIXME should be in actions import { unlock } from 'reducers/application' // FIXME should be in actions
import Track from 'analytics/Track' import Track from 'analytics/Track'
import CheckBox from 'components/base/CheckBox' import Switch from 'components/base/Switch'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import Button from 'components/base/Button' import Button from 'components/base/Button'
import PasswordModal from './PasswordModal' import PasswordModal from './PasswordModal'
@ -100,7 +100,7 @@ class DisablePasswordButton extends PureComponent<Props, State> {
{t('app:settings.profile.changePassword')} {t('app:settings.profile.changePassword')}
</Button> </Button>
)} )}
<CheckBox isChecked={isPasswordEnabled} onChange={this.handleChangePasswordCheck} /> <Switch isChecked={isPasswordEnabled} onChange={this.handleChangePasswordCheck} />
</Box> </Box>
<PasswordModal <PasswordModal

4
src/components/SettingsPage/SentryLogsButton.js

@ -6,7 +6,7 @@ import { createStructuredSelector } from 'reselect'
import { setSentryLogs } from 'actions/settings' import { setSentryLogs } from 'actions/settings'
import { sentryLogsSelector } from 'reducers/settings' import { sentryLogsSelector } from 'reducers/settings'
import Track from 'analytics/Track' import Track from 'analytics/Track'
import CheckBox from 'components/base/CheckBox' import Switch from 'components/base/Switch'
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
sentryLogs: sentryLogsSelector, sentryLogs: sentryLogsSelector,
@ -27,7 +27,7 @@ class SentryLogsButton extends PureComponent<Props> {
return ( return (
<Fragment> <Fragment>
<Track onUpdate event={sentryLogs ? 'SentryEnabled' : 'SentryDisabled'} /> <Track onUpdate event={sentryLogs ? 'SentryEnabled' : 'SentryDisabled'} />
<CheckBox isChecked={sentryLogs} onChange={setSentryLogs} /> <Switch isChecked={sentryLogs} onChange={setSentryLogs} />
</Fragment> </Fragment>
) )
} }

4
src/components/SettingsPage/ShareAnalyticsButton.js

@ -5,7 +5,7 @@ import { createStructuredSelector } from 'reselect'
import { setShareAnalytics } from 'actions/settings' import { setShareAnalytics } from 'actions/settings'
import { shareAnalyticsSelector } from 'reducers/settings' import { shareAnalyticsSelector } from 'reducers/settings'
import Track from 'analytics/Track' import Track from 'analytics/Track'
import CheckBox from 'components/base/CheckBox' import Switch from 'components/base/Switch'
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
shareAnalytics: shareAnalyticsSelector, shareAnalytics: shareAnalyticsSelector,
@ -26,7 +26,7 @@ class ShareAnalytics extends PureComponent<Props> {
return ( return (
<Fragment> <Fragment>
<Track onUpdate event={shareAnalytics ? 'AnalyticsEnabled' : 'AnalyticsDisabled'} /> <Track onUpdate event={shareAnalytics ? 'AnalyticsEnabled' : 'AnalyticsDisabled'} />
<CheckBox isChecked={shareAnalytics} onChange={setShareAnalytics} /> <Switch isChecked={shareAnalytics} onChange={setShareAnalytics} />
</Fragment> </Fragment>
) )
} }

6
src/components/base/CheckBox/index.js → src/components/base/Switch/index.js

@ -37,7 +37,7 @@ type Props = {
onChange?: Function, onChange?: Function,
} }
function CheckBox(props: Props) { function Switch(props: Props) {
const { isChecked, onChange, ...p } = props const { isChecked, onChange, ...p } = props
return ( return (
<Base isChecked={isChecked} onClick={() => onChange && onChange(!isChecked)} {...p}> <Base isChecked={isChecked} onClick={() => onChange && onChange(!isChecked)} {...p}>
@ -46,8 +46,8 @@ function CheckBox(props: Props) {
) )
} }
CheckBox.defaultProps = { Switch.defaultProps = {
onChange: noop, onChange: noop,
} }
export default CheckBox export default Switch

6
src/components/base/CheckBox/stories.js → src/components/base/Switch/stories.js

@ -3,10 +3,10 @@ import { storiesOf } from '@storybook/react'
import { boolean } from '@storybook/addon-knobs' import { boolean } from '@storybook/addon-knobs'
import { action } from '@storybook/addon-actions' import { action } from '@storybook/addon-actions'
import CheckBox from 'components/base/CheckBox' import Switch from 'components/base/Switch'
const stories = storiesOf('Components/base', module) const stories = storiesOf('Components/base', module)
stories.add('CheckBox', () => ( stories.add('Switch', () => (
<CheckBox isChecked={boolean('isChecked', false)} onChange={action('onChange')} /> <Switch isChecked={boolean('isChecked', false)} onChange={action('onChange')} />
)) ))

2
src/components/modals/ReleaseNotes.js

@ -138,7 +138,7 @@ export const Notes = styled(Box).attrs({
} }
} }
input[type='checkbox'] { input[type='Switch'] {
margin-right: 0.5em; margin-right: 0.5em;
} }
` `

Loading…
Cancel
Save