Last active
April 23, 2021 12:42
-
-
Save joboccara/e9d24a2f25b9a86edaa806b6a534c332 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Page = ({ user, children, onLogin, onAddComment }) => { | |
if (!user.isLoggedIn) { | |
return ( | |
<Layout> | |
<h3>Please log in to see and post comments</h3> | |
<PasswordInput/> | |
<button onClick={onLogin}>Login!</button> | |
</Layout> | |
); | |
} | |
return ( | |
<Layout> | |
<h3>Comments section</h3> | |
<CommentInput /> | |
<button onClick={onAddComment}> | |
Add comment | |
</button> | |
{children} | |
</Layout> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment