-
Notifications
You must be signed in to change notification settings - Fork 1
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
6 changed files
with
98 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Autocomplete, TextField } from '@mui/material'; | ||
import { useEffect } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { setCategory } from 'src/redux/slices/filter'; | ||
|
||
export default function CategoryAutoComplete() { | ||
const top100Films = [ | ||
'전공 마일리지', | ||
'비교과 - 연구활동', | ||
'비교과 - 봉사활동', | ||
'비교과 - 창업활동', | ||
]; | ||
|
||
const value = useSelector((state) => state.filter.category); | ||
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
console.log(value); | ||
}, [value]); | ||
|
||
return ( | ||
<Autocomplete | ||
value={value} | ||
disablePortal | ||
id="combo-box-demo" | ||
options={top100Films} | ||
renderInput={(params) => <TextField {...params} label="카테고리" />} | ||
onChange={(e, newValue) => dispatch(setCategory(newValue))} | ||
/> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { createSlice } from '@reduxjs/toolkit'; | ||
|
||
const initialState = { | ||
mileageCategoryList: [], | ||
}; | ||
|
||
const slice = createSlice({ | ||
name: 'data', | ||
initialState, | ||
reducers: { | ||
setMileageCategoryList: (state, action) => { | ||
state.mileageCategoryList = action.payload; | ||
}, | ||
}, | ||
}); | ||
|
||
// Reducer | ||
export const { setMileageCategoryList } = slice.actions; | ||
export default slice.reducer; |
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