aesthetic-react
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2
import React from 'react'; | ||
export default React.createContext({ | ||
changeTheme: function changeTheme() {}, | ||
theme: '' | ||
themeName: '' | ||
}); |
@@ -33,3 +33,3 @@ import _pt from "prop-types"; | ||
_this.ctx.theme = theme; | ||
_this.ctx.themeName = theme; | ||
@@ -46,2 +46,18 @@ _this.setState({ | ||
_proto.componentDidMount = function componentDidMount() { | ||
var name = this.props.name; | ||
if (name && name !== this.state.theme) { | ||
this.changeTheme(name); | ||
} | ||
}; | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
var name = this.props.name; | ||
if (name && name !== prevProps.name) { | ||
this.changeTheme(name); | ||
} | ||
}; | ||
_proto.render = function render() { | ||
@@ -51,3 +67,3 @@ if (!this.ctx) { | ||
changeTheme: this.changeTheme, | ||
theme: this.state.theme | ||
themeName: this.state.theme | ||
}; | ||
@@ -66,5 +82,6 @@ } | ||
aesthetic: _pt.any.isRequired, | ||
children: _pt.any.isRequired | ||
children: _pt.any.isRequired, | ||
name: _pt.any | ||
}); | ||
export { ThemeProvider as default }; |
@@ -12,5 +12,5 @@ "use strict"; | ||
changeTheme: function changeTheme() {}, | ||
theme: '' | ||
themeName: '' | ||
}); | ||
exports.default = _default; |
@@ -7,2 +7,3 @@ import React from 'react'; | ||
children: NonNullable<React.ReactNode>; | ||
name?: ThemeName; | ||
} | ||
@@ -17,2 +18,4 @@ export interface ThemeProviderState { | ||
}; | ||
componentDidMount(): void; | ||
componentDidUpdate(prevProps: ThemeProviderProps): void; | ||
changeTheme: (theme: string) => void; | ||
@@ -19,0 +22,0 @@ render(): JSX.Element; |
@@ -41,3 +41,3 @@ "use strict"; | ||
_this.ctx.theme = theme; | ||
_this.ctx.themeName = theme; | ||
@@ -54,2 +54,18 @@ _this.setState({ | ||
_proto.componentDidMount = function componentDidMount() { | ||
var name = this.props.name; | ||
if (name && name !== this.state.theme) { | ||
this.changeTheme(name); | ||
} | ||
}; | ||
_proto.componentDidUpdate = function componentDidUpdate(prevProps) { | ||
var name = this.props.name; | ||
if (name && name !== prevProps.name) { | ||
this.changeTheme(name); | ||
} | ||
}; | ||
_proto.render = function render() { | ||
@@ -59,3 +75,3 @@ if (!this.ctx) { | ||
changeTheme: this.changeTheme, | ||
theme: this.state.theme | ||
themeName: this.state.theme | ||
}; | ||
@@ -76,3 +92,4 @@ } | ||
aesthetic: _propTypes.default.any.isRequired, | ||
children: _propTypes.default.any.isRequired | ||
children: _propTypes.default.any.isRequired, | ||
name: _propTypes.default.any | ||
}); |
@@ -6,3 +6,3 @@ import React from 'react'; | ||
changeTheme: (theme: ThemeName) => void; | ||
theme: ThemeName; | ||
themeName: ThemeName; | ||
} | ||
@@ -9,0 +9,0 @@ export interface WithThemeWrapperProps { |
{ | ||
"name": "aesthetic-react", | ||
"version": "1.0.0-alpha.1", | ||
"version": "1.0.0-alpha.2", | ||
"description": "React hooks, composers, and more for styling components with Aesthetic.", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "a25d2dcdf580331c8aeb9174e30c4cc14e40efc3" | ||
"gitHead": "b86eeb31550445983a67cd9e59fa17c257d85707" | ||
} |
Sorry, the diff of this file is not supported yet
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
49949
783