Skip to content

Commit

Permalink
Also make withAuthenticator configurable in aws-amplify-react
Browse files Browse the repository at this point in the history
  • Loading branch information
rlmartin committed Feb 14, 2018
1 parent 9a0c4bb commit 19bfef1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
5 changes: 4 additions & 1 deletion packages/aws-amplify-react/dist/Auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"

function withAuthenticator(Comp) {
var includeGreetings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var authenticatorComponents = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];

return function (_Component) {
_inherits(_class, _Component);
Expand Down Expand Up @@ -253,7 +254,9 @@ function withAuthenticator(Comp) {
}

return _react2['default'].createElement(_Authenticator2['default'], _extends({}, this.props, {
onStateChange: this.handleAuthStateChange
hideDefault: authenticatorComponents.length > 0,
onStateChange: this.handleAuthStateChange,
children: authenticatorComponents
}));
}

Expand Down
19 changes: 16 additions & 3 deletions packages/aws-amplify-react/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ Object.defineProperty(exports, "__esModule", {
});
exports.white1X1 = exports.transparent1X1 = exports.AmplifyMessageMapEntries = exports.AmplifyTheme = undefined;

var _AmplifyUI = require('./AmplifyUI');

Object.keys(_AmplifyUI).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
function get() {
return _AmplifyUI[key];
}

return get;
}()
});
});

var _Auth = require('./Auth');

Object.keys(_Auth).forEach(function (key) {
Expand Down Expand Up @@ -94,9 +110,6 @@ Object.defineProperty(exports, 'AmplifyMessageMapEntries', {
return get;
}()
});

var _AmplifyUI = require('./AmplifyUI');

Object.defineProperty(exports, 'transparent1X1', {
enumerable: true,
get: function () {
Expand Down
4 changes: 3 additions & 1 deletion packages/aws-amplify-react/src/Auth/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export * from './Provider';

import Greetings from './Greetings';

export function withAuthenticator(Comp, includeGreetings=false) {
export function withAuthenticator(Comp, includeGreetings=false, authenticatorComponents = []) {
return class extends Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -74,7 +74,9 @@ export function withAuthenticator(Comp, includeGreetings=false) {

return <Authenticator
{...this.props}
hideDefault={authenticatorComponents.length > 0}
onStateChange={this.handleAuthStateChange}
children={authenticatorComponents}
/>
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/aws-amplify-react/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { I18n } from 'aws-amplify';

import dict from './AmplifyI18n';

export * from './AmplifyUI';
export * from './Auth';
export * from './Analytics';
export * from './Storage';
Expand Down

0 comments on commit 19bfef1

Please sign in to comment.