+
{props.name}
{props.volume}
{props.ratio}
diff --git a/src/containers/ViewRecipe/Function/ViewRecipe.scss b/src/containers/ViewRecipe/Function/ViewRecipe.scss
index 77812bb..c37dd14 100644
--- a/src/containers/ViewRecipe/Function/ViewRecipe.scss
+++ b/src/containers/ViewRecipe/Function/ViewRecipe.scss
@@ -25,6 +25,7 @@
.detail-content-header-info-count {
display: block;
+ height: 51px;
span::before {
content: '';
@@ -88,29 +89,21 @@
margin-top: 0;
}
- .side-info-alcohol {
- list-style: none;
- padding: 0;
- margin: 0;
-
- li {
- display: block;
- float: left;
- width: 92px;
- height: 92px;
- margin-top: 20px;
- border: 1px solid #ffffff;
- box-sizing: border-box;
- border-radius: 10px;
- }
-
- }
-
.content {
font-weight: normal;
margin-top: 21px;
}
+ .alcohol {
+ display: block;
+ width: 92px;
+ height: 92px;
+ margin-top: 20px;
+ border: 1px solid #ffffff;
+ box-sizing: border-box;
+ border-radius: 10px;
+ }
+
.tags {
color: #97d9eb;
}
@@ -128,6 +121,10 @@
width: 100%;
height: calc(100% - 60px);
+ div {
+ height: auto;
+ }
+
.detail-content-main-side-stuff-container {
position: absolute;
width: 100%;
@@ -157,9 +154,6 @@
.stuff-color {
display: inline-block;
width: 8%;
- border: 1px solid #707070;
- border-radius: 5px;
- box-sizing: border-box;
margin-left: 5%;
}
@@ -211,6 +205,10 @@
.detail-content-main-side-comment {
height: calc(100% - 60px);
+ div {
+ height: auto;
+ }
+
.detail-content-main-side-comment-container {
height: calc(100% - 74px);
diff --git a/src/containers/ViewRecipe/ViewRecipe.jsx b/src/containers/ViewRecipe/ViewRecipe.jsx
index cd16f57..4681f32 100644
--- a/src/containers/ViewRecipe/ViewRecipe.jsx
+++ b/src/containers/ViewRecipe/ViewRecipe.jsx
@@ -10,43 +10,70 @@ import RecipeInfo from "./Function/SideInfo";
import RecipeStuff from "./Function/SideStuff";
import RecipePhoto from "./Function/SidePhoto";
import RecipeComment from "./Function/SideComment";
+import { recipeIDRequest } from "../../action/recipeAction"
const cx = classNames.bind(styles);
const mapStateToProps = state => {
- return state;
+ return {
+ recipe_info: state.recipeReducer.recipe_info,
+ stuffs: state.recipeReducer.stuffs,
+ photos: state.recipeReducer.photos,
+ comments: state.recipeReducer.comments
+ };
};
-const mapDispatchToProps = {};
+const mapDispatchToProps = { recipeIDRequest };
class ViewRecipe extends Component {
- recipe_info = {name: "레시피 이름", descripe: "이 레시피에 대한 설명", tags: "#태그 #태그 #태그"};
-
state = {
+ recipe_info: {
+ cocktail: "",
+ description: "",
+ nick: "",
+ like: 0,
+ comment: 0,
+ view: 0,
+ tags: []
+ },
+ stuffs: [],
+ photos: [],
+ comments: [],
main:
,
side:
-
,
- stuffs: [
- {name:"재료 이름123", volume: "용량ml", ratio: "30%"},
- {name:"재료 이름2", volume: "용량ml", ratio: "30%"},
- {name:"재료 이름3", volume: "용량ml", ratio: "30%"}
- ],
- photos: [
- "사진 1", "사진 2", "사진 3", "사진 4", "사진 5", "사진 6", "사진 7", "사진 8"
- ],
- comments: [
- {nick: "닉네임 A", comments: "댓글내용 1", time: "00:00"},
- {nick: "닉네임 B", comments: "댓글내용 2", time: "11:11"},
- {nick: "닉네임 C", comments: "댓글내용 3", time: "22:22"},
- {nick: "닉네임 D", comments: "댓글내용 4", time: "12:44"}
- ],
- cocktail_info: {cocktail: "칵테일 이름", nick: "등록한 사람 닉네임", like :"85", comment :"35"}
+
};
+ componentDidMount() {
+ this.props.recipeIDRequest("5c9b94e7e1723e5834f0eede");
+ }
+
+ componentDidUpdate(prevProps, prevState) {
+ if (prevProps.stuff === undefined && prevProps.photos === undefined && prevProps.comments === undefined && prevProps.recipe_info === undefined) {
+ this.setState({
+ recipe_info: this.props.recipe_info,
+ stuffs: this.props.stuffs,
+ photos: this.props.photos,
+ comments: this.props.comments,
+ side:
+
+ }, () => {
+ document.getElementById('cocktail').innerHTML = this.props.recipe_info.cocktail;
+ document.getElementById('description').innerHTML = this.props.recipe_info.description;
+ // document.getElementById('alcohol').innerHTML = '...';
+ document.getElementById('tag').innerHTML = this.props.recipe_info.tags.join(' ');
+ });
+ }
+ }
+
onChangeFocusing = event => {
let info = document.querySelector("#info");
let stuff = document.querySelector("#stuff");
@@ -58,9 +85,9 @@ class ViewRecipe extends Component {
main:
,
side:
} );
@@ -122,10 +149,10 @@ class ViewRecipe extends Component {
diff --git a/src/reducer/enrolmentReducer.js b/src/reducer/enrolmentReducer.js
new file mode 100644
index 0000000..d1f38e8
--- /dev/null
+++ b/src/reducer/enrolmentReducer.js
@@ -0,0 +1,22 @@
+import { actions } from "../action/enrolmentAction";
+const initialState = {
+ state: "fail"
+};
+
+const reducer = (state = initialState, action) => {
+ switch (action.type) {
+ case actions.ENROLMENT.SUCCESS: {
+ const { result } = action.payload;
+
+ return {
+ ...state,
+ result,
+ state: "success"
+ };
+ }
+ default:
+ return state;
+ }
+};
+
+export default reducer;
diff --git a/src/reducer/recipeReducer.js b/src/reducer/recipeReducer.js
new file mode 100644
index 0000000..25a0ca2
--- /dev/null
+++ b/src/reducer/recipeReducer.js
@@ -0,0 +1,75 @@
+import { actions } from "../action/recipeAction";
+const initialState = {
+ state: "fail"
+};
+
+const reducer = (state = initialState, action) => {
+ switch (action.type) {
+ case actions.ALL.SUCCESS: {
+ const { result } = action.payload;
+ return {
+ bAllRecipeResult: result
+ };
+ }
+ case actions.BYID.SUCCESS: {
+ const { result } = action.payload;
+
+ const stuffs = result[0].ingredient;
+ // const photos = result[0].
+ const photos = ["테스트 1", "테스트 2", "테스트 3", "테스트 4"];
+ // const comments = result[0].
+ const comments = [
+ {nick: "닉네임 A", comments: "댓글내용 1", time: "00:00"},
+ {nick: "닉네임 B", comments: "댓글내용 2", time: "11:11"},
+ {nick: "닉네임 C", comments: "댓글내용 3", time: "22:22"},
+ {nick: "닉네임 D", comments: "댓글내용 4", time: "12:44"}
+ ];
+ const recipe_info = {
+ cocktail: result[0].name,
+ description: result[0].description,
+ nick: result[0].owner,
+ like: result[0].scrap,
+ comment: 0,
+ view: result[0].view,
+ tags: result[0].tag
+ };
+
+ return {
+ ...state,
+ state: "success",
+ stuffs: stuffs,
+ photos: photos,
+ comments: comments,
+ recipe_info: recipe_info
+ };
+ }
+ case actions.TAGBYLATEST.SUCCESS: {
+ const { result } = action.payload;
+ return {
+ bIDCheckResult: result
+ };
+ }
+ case actions.TAGBYVIEW.SUCCESS: {
+ const { result } = action.payload;
+ return {
+ bIDCheckResult: result
+ };
+ }
+ case actions.STUFFBYLATEST.SUCCESS: {
+ const { result } = action.payload;
+ return {
+ bIDCheckResult: result
+ };
+ }
+ case actions.STUFFBYVIEW.SUCCESS: {
+ const { result } = action.payload;
+ return {
+ bIDCheckResult: result
+ };
+ }
+ default:
+ return state;
+ }
+};
+
+export default reducer;
diff --git a/src/reducer/rootReducer.js b/src/reducer/rootReducer.js
index dd8fc65..d27175c 100644
--- a/src/reducer/rootReducer.js
+++ b/src/reducer/rootReducer.js
@@ -5,5 +5,7 @@
import { combineReducers } from "redux";
import userReducer from "./userReducer";
import searchReducer from "./searchReducer";
+import recipeReducer from "./recipeReducer";
+import enrolmentReducer from "./enrolmentReducer";
-export default combineReducers({ userReducer, searchReducer });
+export default combineReducers({ userReducer, searchReducer, recipeReducer, enrolmentReducer });
diff --git a/src/saga/enrolmentSaga.js b/src/saga/enrolmentSaga.js
new file mode 100644
index 0000000..78c11d2
--- /dev/null
+++ b/src/saga/enrolmentSaga.js
@@ -0,0 +1,23 @@
+import { all, call, put, takeLatest } from "redux-saga/effects";
+import {
+ actions,
+ enrolmentSuccess
+
+} from "../action/enrolmentAction";
+import {
+ enrolmentRecipe
+ } from "../api/enrolmentAPI";
+
+function* enrolmentRecipeRequest (action) {
+ try {
+ const { data } = action.payload;
+ const result = yield call(enrolmentRecipe, {data});
+ yield put(enrolmentSuccess(result));
+ } catch (error) {}
+}
+
+export default function* saga() {
+ yield all([
+ takeLatest(actions.ENROLMENT.REQUEST, enrolmentRecipeRequest)
+ ]);
+}
diff --git a/src/saga/recipeSaga.js b/src/saga/recipeSaga.js
new file mode 100644
index 0000000..d9f51e6
--- /dev/null
+++ b/src/saga/recipeSaga.js
@@ -0,0 +1,76 @@
+import { all, call, put, takeEvery } from "redux-saga/effects";
+import {
+ actions,
+ recipeAllSuccess,
+ recipeIDSuccess,
+ recipeTagLatestSuccess,
+ recipeTagViewSuccess,
+ recipeStuffLatestSuccess,
+ recipeStuffViewSuccess
+} from "../action/recipeAction";
+import {
+ getRecipe,
+ getRecipeByID,
+ getTagByLatest,
+ getTagByView,
+ getStuffByLatest,
+ getStuffByView
+ } from "../api/recipeAPI";
+
+function* requestAll () {
+ try {
+ const result = yield call(getRecipe);
+ yield put(recipeAllSuccess(result));
+ } catch (error) {}
+}
+
+function* requestRecipeByID(action) {
+ const { id } = action.payload;
+ try {
+ const result = yield call(getRecipeByID, {id});
+ yield put(recipeIDSuccess(result));
+ } catch (error) {}
+}
+
+function* requestRecipeTagByLatest(action) {
+ const { tag } = action.payload;
+ try {
+ const result = yield call(getTagByLatest, tag);
+ yield put(recipeTagLatestSuccess(result));
+ } catch (error) {}
+}
+
+function* requestRecipeTagByView(action) {
+ const { tag } = action.payload;
+ try {
+ const result = yield call(getTagByView, tag);
+ yield put(recipeTagViewSuccess(result));
+ } catch (error) {}
+}
+
+function* requestRecipeStuffByLatest(action) {
+ const { ingredient } = action.payload;
+ try {
+ const result = yield call(getStuffByLatest, ingredient);
+ yield put(recipeStuffLatestSuccess(result));
+ } catch (error) {}
+}
+
+function* requestRecipeStuffByView(action) {
+ const { ingredient } = action.payload;
+ try {
+ const result = yield call(getStuffByView, ingredient);
+ yield put(recipeStuffViewSuccess(result));
+ } catch (error) {}
+}
+
+export default function* saga() {
+ yield all([
+ takeEvery(actions.ALL.REQUEST, requestAll),
+ takeEvery(actions.BYID.REQUEST, requestRecipeByID),
+ takeEvery(actions.TAGBYLATEST.REQUEST, requestRecipeTagByLatest),
+ takeEvery(actions.TAGBYVIEW.REQUEST, requestRecipeTagByView),
+ takeEvery(actions.STUFFBYLATEST.REQUEST, requestRecipeStuffByLatest),
+ takeEvery(actions.STUFFBYVIEW.REQUEST, requestRecipeStuffByView)
+ ]);
+}
diff --git a/src/saga/rootSaga.js b/src/saga/rootSaga.js
index 7ab1c1f..2cd281b 100644
--- a/src/saga/rootSaga.js
+++ b/src/saga/rootSaga.js
@@ -6,7 +6,9 @@ import { all } from "redux-saga/effects";
import userSaga from "./userSaga";
import searchSaga from "./searchSaga";
+import recipeSaga from "./recipeSaga";
+import enrolmentSaga from "./enrolmentSaga";
export default function* rootSaga() {
- yield all([userSaga(), searchSaga()]);
+ yield all([userSaga(), searchSaga(), recipeSaga(), enrolmentSaga()]);
}
diff --git a/src/saga/userSaga.js b/src/saga/userSaga.js
index 12f6ed5..00a98d0 100644
--- a/src/saga/userSaga.js
+++ b/src/saga/userSaga.js
@@ -10,6 +10,7 @@ import {
import { setJoin, checkID, setLogin } from "../api/userAPI";
function* requestLogin(action) {
+ console.log('test');
try {
const { userid, password } = action.payload;
const result = yield call(setLogin, { userid, password });
diff --git a/src/static/images/logo.png b/src/static/images/logo.png
new file mode 100755
index 0000000..9efad6d
Binary files /dev/null and b/src/static/images/logo.png differ