Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unknown props #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions build/components/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ var _classnames2 = _interopRequireDefault(_classnames);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
Expand All @@ -40,13 +42,18 @@ var Hero = exports.Hero = function (_React$Component) {
key: "render",
value: function render() {
var _style = {};
if (this.props.backgroundImage) {
_style.backgroundImage = "url(" + this.props.backgroundImage + ")";

var _props = this.props,
backgroundImage = _props.backgroundImage,
otherProps = _objectWithoutProperties(_props, ["backgroundImage"]);

if (backgroundImage) {
_style.backgroundImage = "url(" + backgroundImage + ")";
}
var _className = (0, _classnames2.default)("neal-hero jumbotron jumbotron-fluid", this.props.className);
return _react2.default.createElement(
"div",
_extends({}, this.props, { className: _className, style: _style }),
_extends({}, otherProps, { className: _className, style: _style }),
_react2.default.createElement(
_bootstrap.Container,
null,
Expand Down
13 changes: 10 additions & 3 deletions build/components/section.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var _classnames2 = _interopRequireDefault(_classnames);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
Expand All @@ -38,16 +40,21 @@ var Section = exports.Section = function (_React$Component) {
key: "render",
value: function render() {
var _className = (0, _classnames2.default)("neal-section", this.props.className);

var _props = this.props,
heading = _props.heading,
otherProps = _objectWithoutProperties(_props, ["heading"]);

return _react2.default.createElement(
"div",
_extends({}, this.props, { className: _className }),
_extends({}, otherProps, { className: _className }),
_react2.default.createElement(
"div",
{ className: "container" },
this.props.heading ? _react2.default.createElement(
heading ? _react2.default.createElement(
"h2",
null,
this.props.heading
heading
) : null,
this.props.children
)
Expand Down
7 changes: 4 additions & 3 deletions js/components/hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ export class Hero extends React.Component {

render() {
const _style = {};
if (this.props.backgroundImage) {
_style.backgroundImage = `url(${this.props.backgroundImage})`;
const { backgroundImage, ...otherProps } = this.props;
if (backgroundImage) {
_style.backgroundImage = `url(${backgroundImage})`;
}
const _className = classNames("neal-hero jumbotron jumbotron-fluid", this.props.className);
return (
<div {... this.props} className={_className} style={_style}>
<div {... otherProps} className={_className} style={_style}>
<Container>
{ this.props.children }
</Container>
Expand Down
5 changes: 3 additions & 2 deletions js/components/section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ export class Section extends React.Component {

render() {
const _className = classNames("neal-section", this.props.className);
const { heading, ...otherProps } = this.props;
return (
<div {... this.props} className={_className}>
<div {... otherProps} className={_className}>
<div className="container">
{ this.props.heading ? <h2>{this.props.heading}</h2> : null }
{ heading ? <h2>{heading}</h2> : null }
{this.props.children}
</div>
</div>
Expand Down