-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
135 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,70 @@ | ||
import React from 'react' | ||
import Link from 'next/link' | ||
import firebase from 'firebase'; | ||
import firebaseApp from '../firebase/firebaseApp'; | ||
import { withAppContext } from '../contexts/AppContext'; | ||
|
||
const links = [ | ||
{ href: 'https://zeit.co/now', label: 'ZEIT' }, | ||
{ href: 'https://github.com/zeit/next.js', label: 'GitHub' } | ||
].map(link => { | ||
link.key = `nav-link-${link.href}-${link.label}` | ||
return link | ||
}) | ||
|
||
const Nav = () => ( | ||
<nav> | ||
<ul> | ||
<li> | ||
<Link href='/'> | ||
<a>Home</a> | ||
</Link> | ||
</li> | ||
{links.map(({ key, href, label }) => ( | ||
<li key={key}> | ||
<a href={href}>{label}</a> | ||
let Nav = props => { | ||
const googleLogin = () => { | ||
var provider = new firebase.auth.GoogleAuthProvider(); | ||
provider.addScope('profile'); | ||
provider.addScope('email'); | ||
firebaseApp.auth().signInWithPopup(provider); | ||
// firebaseApp.auth().signInWithRedirect(provider); | ||
} | ||
return( | ||
<nav> | ||
<ul> | ||
<li> | ||
<Link href='/feeds'> | ||
<a>피드 목록</a> | ||
</Link> | ||
</li> | ||
<li> | ||
{ props.context.user && ( | ||
<> | ||
{ props.context.user.displayName } | ||
</> | ||
) } | ||
{ !props.context.user && ( | ||
<button className="btn btn-white" onClick={ googleLogin }> | ||
로그인 | ||
</button> | ||
) } | ||
|
||
</li> | ||
))} | ||
</ul> | ||
</ul> | ||
|
||
<style jsx>{` | ||
:global(body) { | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, Avenir Next, Avenir, | ||
Helvetica, sans-serif; | ||
} | ||
nav { | ||
text-align: center; | ||
} | ||
ul { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
nav > ul { | ||
padding: 4px 16px; | ||
} | ||
li { | ||
display: flex; | ||
padding: 6px 8px; | ||
} | ||
a { | ||
color: #067df7; | ||
text-decoration: none; | ||
font-size: 13px; | ||
} | ||
`}</style> | ||
</nav> | ||
) | ||
} | ||
|
||
<style jsx>{` | ||
:global(body) { | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, Avenir Next, Avenir, | ||
Helvetica, sans-serif; | ||
} | ||
nav { | ||
text-align: center; | ||
} | ||
ul { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
nav > ul { | ||
padding: 4px 16px; | ||
} | ||
li { | ||
display: flex; | ||
padding: 6px 8px; | ||
} | ||
a { | ||
color: #067df7; | ||
text-decoration: none; | ||
font-size: 13px; | ||
} | ||
`}</style> | ||
</nav> | ||
) | ||
Nav = withAppContext( Nav ); | ||
|
||
export default Nav |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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