-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open reason registration popup on deniel
- Loading branch information
1 parent
fa1c552
commit c14ecff
Showing
6 changed files
with
164 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
|
||
const InputField = ({text, placeholder}) => { | ||
return ( | ||
<div> | ||
<label htmlFor="text">{text}</label> | ||
<input type="text" name="text" placeholder={placeholder} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default InputField; |
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,54 @@ | ||
export const SET_SELECTED_ITEM = 'investChange/SET_SELECTED_ITEM'; | ||
export const SET_UPLOADED_FILES = 'investChange/SET_UPLOADED_FILES'; | ||
export const REMOVE_UPLOADED_FILE = 'investChange/REMOVE_UPLOADED_FILE'; | ||
|
||
export const setSelectedItem = (item) => { | ||
return { | ||
type: SET_SELECTED_ITEM, | ||
payload: item, | ||
}; | ||
}; | ||
|
||
export const setUploadedFiles = (files) => { | ||
return { | ||
type: SET_UPLOADED_FILES, | ||
payload: files, | ||
}; | ||
}; | ||
|
||
export const removeUploadedFile = (fileIndex) => { | ||
return { | ||
type: REMOVE_UPLOADED_FILE, | ||
payload: fileIndex, | ||
}; | ||
}; | ||
|
||
const initialState = { | ||
selectedItem: null, | ||
uploadedFiles: [], | ||
}; | ||
|
||
const investmentReducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
case SET_SELECTED_ITEM: | ||
return { | ||
...state, | ||
selectedItem: action.payload, | ||
}; | ||
case SET_UPLOADED_FILES: | ||
return { | ||
...state, | ||
uploadedFiles: action.payload, | ||
}; | ||
case REMOVE_UPLOADED_FILE: | ||
const fileIndex = action.payload; | ||
return { | ||
...state, | ||
uploadedFiles: state.uploadedFiles.filter((_f, index) => index !== fileIndex), | ||
}; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export default investmentReducer; |
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,55 @@ | ||
export const TOGGLE_CHECKBOX = 'registerReason/TOGGLE_CHECKBOX'; | ||
export const UPDATE_TEXTAREA = 'registerReason/UPDATE_TEXTAREA'; | ||
export const RESET_REGISTER_MODAL = 'registerReason/RESET_REGISTER_MODAL'; | ||
|
||
export const toggleCheckbox = (label) => ({ | ||
type: TOGGLE_CHECKBOX, | ||
payload: label, | ||
}); | ||
|
||
export const resetRegisterModal = () => ({ | ||
type: RESET_REGISTER_MODAL | ||
}); | ||
|
||
export const updateTextarea = (value) => ({ | ||
type: UPDATE_TEXTAREA, | ||
payload: value, | ||
}); | ||
|
||
|
||
const initialState = { | ||
checkboxes: { | ||
'서류 식별 불가': false, | ||
'필수 서류 누락': false, | ||
'서류의 내용이 등록된 회원정보와 다름': false, | ||
'서류에 누락된 내용이 있음 (필수정보, 회사직인, 본인날인, 본인서명 등)': false, | ||
'서류의 유효기간이 초과됨': false, | ||
'직접 입력': false, | ||
}, | ||
textarea: '', | ||
}; | ||
|
||
const registerReasonReducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
case TOGGLE_CHECKBOX: | ||
const { payload: label } = action; | ||
const checkboxes = {}; | ||
|
||
// Set the clicked checkbox to true, and others to false | ||
Object.keys(state.checkboxes).forEach((key) => { | ||
checkboxes[key] = key === label; | ||
}); | ||
|
||
return { ...state, checkboxes }; | ||
|
||
case UPDATE_TEXTAREA: | ||
return { ...state, textarea: action.payload }; | ||
|
||
case RESET_REGISTER_MODAL: | ||
return initialState; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export default registerReasonReducer; |