stylized-component
Advanced tools
Comparing version 0.0.8 to 0.0.9
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
import * as PropTypes from 'prop-types'; | ||
import { Component } from 'react'; | ||
import { ThemeProviderContext } from './ThemeProvider'; | ||
export declare class StyledComponent<ComponentTheme, Props, State> extends React.Component<Props, State> { | ||
export declare class StyledComponent<Styles, Props extends Styles, State> extends Component<Props, State> { | ||
static contextTypes: { | ||
@@ -10,3 +10,3 @@ theme: PropTypes.Requireable<any>; | ||
context: ThemeProviderContext; | ||
style: Partial<ComponentTheme>; | ||
style: Partial<Styles>; | ||
themeKey: string; | ||
@@ -13,0 +13,0 @@ constructor(props: Props, context: ThemeProviderContext); |
@@ -14,4 +14,4 @@ "use strict"; | ||
var _ = require("lodash"); | ||
var React = require("react"); | ||
var PropTypes = require("prop-types"); | ||
var react_1 = require("react"); | ||
var StyledComponent = /** @class */ (function (_super) { | ||
@@ -33,3 +33,3 @@ __extends(StyledComponent, _super); | ||
return StyledComponent; | ||
}(React.Component)); | ||
}(react_1.Component)); | ||
exports.StyledComponent = StyledComponent; | ||
@@ -36,0 +36,0 @@ exports.themeKey = function (key) { |
{ | ||
"name": "stylized-component", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "A design prototype", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import * as _ from 'lodash'; | ||
import * as React from 'react'; | ||
import * as PropTypes from 'prop-types'; | ||
import { Component } from 'react'; | ||
@@ -8,3 +8,3 @@ import { ThemeProviderContext } from './ThemeProvider'; | ||
export class StyledComponent<ComponentTheme, Props, State> extends React.Component<Props, State> { | ||
export class StyledComponent<Styles, Props extends Styles, State> extends Component<Props, State> { | ||
static contextTypes = { | ||
@@ -15,3 +15,3 @@ theme: PropTypes.object, | ||
context: ThemeProviderContext; | ||
style: Partial<ComponentTheme>; | ||
style: Partial<Styles>; | ||
themeKey: string; | ||
@@ -25,3 +25,3 @@ | ||
// 2. Overrides defined in context.theme | ||
const propStyle: Partial<ComponentTheme> = _.extend({}, props); | ||
const propStyle: Partial<Styles> = _.extend({}, props); | ||
const contextStyle = _.get(context, `theme.overrides['${this.themeKey}']`); | ||
@@ -28,0 +28,0 @@ this.style = _.extend(contextStyle, propStyle); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14746