Toggle navigation
Toggle navigation
This project
Loading...
Sign in
MotherProject
/
Jaksimsamil
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
송용우
2020-06-17 13:23:31 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6f6deb2550767fd5667ce3fe70572898e7c81926
6f6deb25
1 parent
7d6214eb
Update Header Menu
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
3 deletions
jaksimsamil-page/src/App.js
jaksimsamil-page/src/components/common/Categories.js
jaksimsamil-page/src/components/common/Header.js
jaksimsamil-page/src/containers/common/HeaderContainer.js
jaksimsamil-page/src/lib/api/client.js
jaksimsamil-page/src/pages/HomePage.js
jaksimsamil-page/src/pages/SettingPage.js
jaksimsamil-page/src/App.js
View file @
6f6deb2
...
...
@@ -4,6 +4,7 @@ import './App.css';
import
LoginPage
from
'./pages/LoginPage'
;
import
RegisterPage
from
'./pages/RegisterPage'
;
import
HomePage
from
'./pages/HomePage'
;
import
SettingPage
from
'./pages/SettingPage'
;
function
App
()
{
return
(
...
...
@@ -11,6 +12,7 @@ function App() {
<
Route
component
=
{
HomePage
}
path
=
{[
'/@:username'
,
'/'
]}
exact
/>
<
Route
component
=
{
LoginPage
}
path
=
"/login"
/>
<
Route
component
=
{
RegisterPage
}
path
=
"/register"
/>
<
Route
component
=
{
SettingPage
}
path
=
"/setting"
/>
<
/
>
);
}
...
...
jaksimsamil-page/src/components/common/Categories.js
0 → 100644
View file @
6f6deb2
import
React
from
'react'
;
import
styled
from
'styled-components'
;
import
{
NavLink
}
from
'react-router-dom'
;
const
categories
=
[
{
name
:
'home'
,
text
:
'홈'
,
},
{
name
:
'setting'
,
text
:
'설정'
,
},
];
const
CategoriesBlock
=
styled
.
div
`
display: flex;
padding: 1rem;
margin: 0 auto;
@media screen and (max-width: 768px) {
width: 100%;
overflow-x: auto;
}
`
;
const
Category
=
styled
(
NavLink
)
`
font-size: 1.2rem;
cursor: pointer;
white-space: pre;
text-decoration: none;
color: inherit;
padding-bottom: 0.25rem;
&:hover {
color: #495057;
}
& + & {
margin-left: 2rem;
}
&.active {
font-weight: 600;
border-bottom: 2px solid #22b8cf;
color: #22b8cf;
&:hover {
color: #3bc9db;
}
}
`
;
const
Categories
=
()
=>
{
return
(
<
CategoriesBlock
>
{
categories
.
map
((
c
)
=>
(
<
Category
activeClassName
=
"active"
key
=
{
c
.
name
}
exact
=
{
c
.
name
===
'home'
}
to
=
{
c
.
name
===
'home'
?
'/'
:
`/
${
c
.
name
}
`
}
>
{
c
.
text
}
<
/Category
>
))}
<
/CategoriesBlock
>
);
};
export
default
Categories
;
jaksimsamil-page/src/components/common/Header.js
View file @
6f6deb2
...
...
@@ -3,6 +3,7 @@ import styled from 'styled-components';
import
Responsive
from
'./Responsive'
;
import
Button
from
'./Button'
;
import
{
Link
}
from
'react-router-dom'
;
import
Categories
from
'./Categories'
;
const
HeaderBlock
=
styled
.
div
`
position: fixed;
...
...
@@ -35,7 +36,7 @@ const UserInfo = styled.div`
margin-right: 1rem;
`
;
const
Header
=
({
user
,
onLogout
})
=>
{
const
Header
=
({
user
,
onLogout
,
category
,
onSelect
})
=>
{
return
(
<>
<
HeaderBlock
>
...
...
@@ -43,6 +44,11 @@ const Header = ({ user, onLogout }) => {
<
Link
to
=
"/"
className
=
"logo"
>
작심삼일
<
/Link
>
<
Categories
category
=
{
category
}
onSelect
=
{
onSelect
}
className
=
"right"
/>
{
user
?
(
<
div
className
=
"right"
>
<
UserInfo
>
{
user
.
username
}
<
/UserInfo
>
...
...
jaksimsamil-page/src/containers/common/HeaderContainer.js
View file @
6f6deb2
...
...
@@ -4,6 +4,7 @@ import Header from '../../components/common/Header';
import
{
logout
}
from
'../../modules/user'
;
const
HeaderContainer
=
()
=>
{
const
{
user
}
=
useSelector
(({
user
})
=>
({
user
:
user
.
user
}));
const
dispatch
=
useDispatch
();
const
onLogout
=
()
=>
{
dispatch
(
logout
());
...
...
jaksimsamil-page/src/lib/api/client.js
View file @
6f6deb2
import
axios
from
'
./
axios'
;
import
axios
from
'axios'
;
const
client
=
axios
.
create
();
export
default
client
;
...
...
jaksimsamil-page/src/pages/HomePage.js
View file @
6f6deb2
...
...
@@ -6,7 +6,7 @@ const HomePage = () => {
return
(
<
div
>
<
HeaderContainer
/>
<
Button
>
test
<
/Button
>
<
Button
>
home
<
/Button
>
<
/div
>
);
};
...
...
jaksimsamil-page/src/pages/SettingPage.js
0 → 100644
View file @
6f6deb2
import
React
from
'react'
;
import
HeaderContainer
from
'../containers/common/HeaderContainer'
;
import
Button
from
'../components/common/Button'
;
const
SettingPage
=
()
=>
{
return
(
<
div
>
<
HeaderContainer
/>
<
Button
>
setting
<
/Button
>
<
/div
>
);
};
export
default
SettingPage
;
Please
register
or
login
to post a comment