Skip to content

Instantly share code, notes, and snippets.

@jrwebdev
Last active February 9, 2018 19:55
Show Gist options
  • Select an option

  • Save jrwebdev/730242600799ec61375fd024a6796a4b to your computer and use it in GitHub Desktop.

Select an option

Save jrwebdev/730242600799ec61375fd024a6796a4b to your computer and use it in GitHub Desktop.
withBlueBackground Subtract
import { Subtract } from 'utility-types';
const withBlueBackground = <P extends InjectedBlueBackgroundProps>(
UnwrappedComponent: React.ComponentType<P>
) =>
class WithBlueBackground extends React.Component<
Subtract<P, InjectedBlueBackgroundProps> & WithBlueBackgroundProps
> {
render() {
const { shade, ...props } = this.props;
return (
<UnwrappedComponent {...props} backgroundColor={getBlueShade(shade)} />
);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment