Skip to content

Commit

Permalink
Use createHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanmarks committed Dec 15, 2016
1 parent e4592fa commit 6da2cf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import React, { Component, PropTypes } from 'react';
import { createStyleSheet } from 'jss-theme-reactor';
import createHelper from 'recompose/createHelper';
import classNames from 'classnames';

export const styleSheet = createStyleSheet('SwitchLabel', (theme) => {
Expand All @@ -23,12 +24,8 @@ export const styleSheet = createStyleSheet('SwitchLabel', (theme) => {
};
});

export function withSwitchLabel(SwitchComponent) {
const switchComponentName = SwitchComponent.displayName || SwitchComponent.name;

function withSwitchLabel(SwitchComponent) {
return class SwitchLabel extends Component {
static displayName = `withSwitchLabel(${switchComponentName})`;

static propTypes = {
/**
* If `true`, the control will be disabled.
Expand Down Expand Up @@ -93,3 +90,5 @@ export function withSwitchLabel(SwitchComponent) {
}
};
}

export default createHelper(withSwitchLabel, 'withSwitchLabel', true, true);
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react';
import { assert } from 'chai';
import { spy } from 'sinon';
import { createShallowWithContext } from 'test/utils';
import { withSwitchLabel, styleSheet } from './SwitchLabel';
import withSwitchLabel, { styleSheet } from './withSwitchLabel';

describe('<SwitchLabel />', () => {
let shallow;
Expand Down

0 comments on commit 6da2cf8

Please sign in to comment.