Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
survey
Commits
6ed85528
Commit
6ed85528
authored
Jul 05, 2022
by
Yoon, Daeki
😅
Browse files
Header 컨텍스트 적용
parent
12f70a45
Changes
1
Show whitespace changes
Inline
Side-by-side
frontend/src/commons/Header.tsx
View file @
6ed85528
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
{
useAuth
}
from
"
../auth/auth.context
"
;
export
const
Header
=
()
=>
(
export
const
Header
=
()
=>
{
const
{
user
,
logout
}
=
useAuth
();
return
(
<
div
className
=
"bg-white border-b-2 border-b-themeColor px-2 sm:px-4 py-2.5"
>
<
div
className
=
"bg-white border-b-2 border-b-themeColor px-2 sm:px-4 py-2.5"
>
<
div
className
=
"container flex flex-wrap justify-between items-center mx-auto"
>
<
div
className
=
"container flex flex-wrap justify-between items-center mx-auto"
>
<
Link
to
=
"/"
className
=
"font-bold text-2xl text-themeColor"
>
<
Link
to
=
"/"
className
=
"font-bold text-2xl text-themeColor"
>
Simple Survey Form
Simple Survey Form
</
Link
>
</
Link
>
<
div
className
=
"md:flex items-center justify-end md:flex-1 lg:w-0"
>
<
div
className
=
"md:flex items-center justify-end md:flex-1 lg:w-0"
>
{
user
.
isLoggedIn
?
(
<
button
onClick
=
{
()
=>
logout
()
}
>
Logout
</
button
>
)
:
(
<
Link
<
Link
to
=
"/login"
to
=
"/login"
className
=
"whitespace-nowrap font-bold text-gray-600 hover:text-themeColor mx-1 py-2 px-3 rounded-md"
className
=
"whitespace-nowrap font-bold text-gray-600 hover:text-themeColor mx-1 py-2 px-3 rounded-md"
>
>
Login
Login
</
Link
>
</
Link
>
)
}
<
Link
<
Link
to
=
"/signup"
to
=
"/signup"
className
=
"whitespace-nowrap font-bold text-white hover:bg-blue-500 mx-1 py-2 px-3 bg-themeColor rounded-md "
className
=
"whitespace-nowrap font-bold text-white hover:bg-blue-500 mx-1 py-2 px-3 bg-themeColor rounded-md "
...
@@ -23,4 +32,5 @@ export const Header = () => (
...
@@ -23,4 +32,5 @@ export const Header = () => (
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment