Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
GCL_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
안형욱
2021-06-14 00:50:36 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
35d1031842eebec150720c3ff926f63d81c663a4
35d10318
1 parent
0bbd42f8
feat: 검색 조건 상태 slice 추가
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
8 deletions
frontend/src/components/Header.js
frontend/src/components/common/DropdownButton.js
frontend/src/features/searchOption.js
frontend/src/pages/HomePage.js
frontend/src/reducers/index.js
frontend/src/components/Header.js
View file @
35d1031
...
...
@@ -126,7 +126,11 @@ const Header = () => {
float
=
"left"
fontsize
=
"20px"
height
=
"50px"
options
=
{[{
id
:
1
,
name
:
'전체'
}]}
options
=
{[
{
id
:
0
,
name
:
'전체'
},
{
id
:
1
,
name
:
'작성자'
},
{
id
:
2
,
name
:
'내용'
},
]}
/
>
<
/DropDownWrap
>
<
/DropDownContainer
>
...
...
frontend/src/components/common/DropdownButton.js
View file @
35d1031
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
TiArrowSortedDown
}
from
'react-icons/ti'
;
import
{
Menu
,
MenuItem
}
from
'@mantine/core'
;
import
{
useDispatch
}
from
'react-redux'
;
import
styled
from
'styled-components'
;
import
{
dropdownHeaderColorMap
}
from
'../../lib/styles/palette'
;
import
{
setSearchOption
}
from
'../../features/searchOption'
;
const
DropDownBlock
=
styled
.
div
`
margin: 0 auto;
...
...
@@ -41,6 +43,7 @@ const DropDown = ({
size
,
})
=>
{
const
[
menuTitle
,
setTitle
]
=
useState
(
''
);
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
setTitle
(
title
);
},
[]);
...
...
@@ -62,14 +65,15 @@ const DropDown = ({
<
/DropDownWrap
>
}
>
{
options
.
map
(
friend
=>
(
{
options
.
map
(
option
=>
(
<
MenuItem
value
=
{
friend
.
id
}
value
=
{
option
.
id
}
onClick
=
{()
=>
{
setTitle
(
friend
.
name
);
dispatch
(
setSearchOption
(
option
.
id
));
setTitle
(
option
.
name
);
}}
>
{
friend
.
name
}
{
option
.
name
}
<
/MenuItem
>
))}
<
/DropDownHeader
>
...
...
frontend/src/features/searchOption.js
0 → 100644
View file @
35d1031
import
{
createSlice
}
from
'@reduxjs/toolkit'
;
const
OPTION
=
[
'ALL'
,
'WRITER'
,
'CONTENT'
];
const
searchOptionSlice
=
createSlice
({
name
:
'searchOption'
,
initialState
:
{
option
:
OPTION
[
0
],
},
reducers
:
{
setSearchOption
:
(
state
,
action
)
=>
{
state
.
option
=
OPTION
[
action
.
payload
];
},
},
});
export
const
{
setSearchOption
}
=
searchOptionSlice
.
actions
;
export
default
searchOptionSlice
.
reducer
;
frontend/src/pages/HomePage.js
View file @
35d1031
...
...
@@ -51,9 +51,9 @@ const HomePage = () => {
fontsize
=
"20px"
height
=
"50px"
options
=
{[
{
id
:
1
,
name
:
'전체'
},
{
id
:
2
,
name
:
'개인
'
},
{
id
:
3
,
name
:
'부서
'
},
{
id
:
0
,
name
:
'전체'
},
{
id
:
1
,
name
:
'작성자
'
},
{
id
:
2
,
name
:
'내용
'
},
]}
/>
<
Input
color
=
"blue"
paddingsize
=
"10px"
width
=
"100%"
display
/>
...
...
frontend/src/reducers/index.js
View file @
35d1031
import
{
combineReducers
}
from
'redux'
;
import
parsedDocumentsReducer
from
'../features/parsedDocumentsSlice'
;
import
searchOptionReducer
from
'../features/searchOption'
;
export
default
combineReducers
({
parsedDocuments
:
parsedDocumentsReducer
,
searchOption
:
searchOptionReducer
,
});
...
...
Please
register
or
login
to post a comment