moved utils
This commit is contained in:
parent
7328964564
commit
bee3d86df7
6 changed files with 2690 additions and 6 deletions
29
src/pages/login.js
Normal file
29
src/pages/login.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// src/components/Layout.js
|
||||
import React from "react"
|
||||
import IdentityModal, { useIdentityContext } from "react-netlify-identity-widget"
|
||||
import "react-netlify-identity-widget/styles.css" // delete if you want to bring your own CSS
|
||||
|
||||
const Layout = ({ children }) => {
|
||||
const identity = useIdentityContext()
|
||||
const [dialog, setDialog] = React.useState(false)
|
||||
const name =
|
||||
(identity && identity.user && identity.user.user_metadata && identity.user.user_metadata.name) || "NoName"
|
||||
|
||||
console.log(JSON.stringify(identity))
|
||||
const isLoggedIn = identity && identity.isLoggedIn
|
||||
return (
|
||||
<>
|
||||
<nav style={{ background: "green" }}>
|
||||
{" "}
|
||||
Login Status:
|
||||
<button className="btn" onClick={() => setDialog(true)}>
|
||||
{isLoggedIn ? `Hello ${name}, Log out here!` : "LOG IN"}
|
||||
</button>
|
||||
</nav>
|
||||
<main>{children}</main>
|
||||
<IdentityModal showDialog={dialog} onCloseDialog={() => setDialog(false)} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Layout
|
||||
Loading…
Add table
Add a link
Reference in a new issue