Skip to content

Commit

Permalink
GN-117 Reinstate propTypes for Naccount placeholder component
Browse files Browse the repository at this point in the history
  • Loading branch information
johndavey72 committed Nov 16, 2021
1 parent f748f72 commit 21e7714
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions src/Header/Account/Naccount.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/prop-types */
import React, { useEffect, useState } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
Expand Down Expand Up @@ -32,19 +31,19 @@ function Naccount(props) {
// this.handleMegaMenuClick = this.handleMegaMenuClick.bind(this);
// }

const [providers] = useState({
idam: "idam",
niceAccounts: "niceAccounts",
});
// const [providers] = useState({
// idam: "idam",
// niceAccounts: "niceAccounts",
// });

const [state, setState] = useState({
isExpanded: false,
useIdAM: props.provider == providers.idam,
useIdAM: props.provider == Naccount.providers.idam,
});

console.log("PROPS ################ ", props);
console.log("PROPS.PROVIDER ################ ", props.provider);
console.log("Naccount providers ", providers);
console.log("Naccount providers ", Naccount.providers);

function handleMyAccountButtonClick(e) {
const isKeyboardEvent = !e.pageX;
Expand Down Expand Up @@ -231,3 +230,35 @@ function Naccount(props) {
}

export default Naccount;

Naccount.providers = {
idam: "idam",
niceAccounts: "niceAccounts",
};

Naccount.propTypes = {
isLoggedIn: PropTypes.bool.isRequired,
onLoginStatusChecked: PropTypes.func,
accountsData: PropTypes.shape({
display_name: PropTypes.string,
thumbnail: PropTypes.string,
links: PropTypes.object,
}),
environment: PropTypes.oneOf(["live", "test", "beta", "local"]),
provider: PropTypes.oneOf([
Naccount.providers.niceAccounts,
Naccount.providers.idam,
]),
links: PropTypes.arrayOf(
PropTypes.shape({
text: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
})
),
displayName: PropTypes.string,
};

Naccount.defaultProps = {
environment: "live",
provider: "niceAccounts",
};

0 comments on commit 21e7714

Please sign in to comment.