diff --git a/src/components/Modal/index.css b/src/components/Modal/index.css
new file mode 100644
index 0000000..e672613
--- /dev/null
+++ b/src/components/Modal/index.css
@@ -0,0 +1,50 @@
+.modalContainer {
+ position: fixed;
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ /* left: 13%; */
+ /* right: 13%; */
+ top: 50px;
+ background-color: white;
+ width: 100%;
+ height: calc(100vh - 50px);
+ border-radius: 7px;
+ /* margin: 20px; */
+}
+
+.modalWrapper {
+ width: 100%;
+}
+
+.postUpdateBtn {
+ float: right;
+ width: 100px;
+ align-self: center;
+ border: none;
+ border-radius: 10px;
+ color: white;
+ background-color: teal;
+ padding: 10px;
+ margin-top: 20px;
+ font-family: 'Josefin Sans', sans-serif;
+ cursor: pointer;
+}
+
+.upPost>label {
+ font-size: 20px;
+ margin-top: 20px;
+}
+
+.upPost>input {
+ color: gray;
+ margin: 10px 0;
+ height: 30px;
+ border: none;
+ width: 60%;
+ border-bottom: 1px solid lightgray;
+}
+.upPost>input:focus{
+ outline: none;
+ border-bottom: 1px solid grey;
+}
diff --git a/src/components/Modal/index.js b/src/components/Modal/index.js
new file mode 100644
index 0000000..4925d0e
--- /dev/null
+++ b/src/components/Modal/index.js
@@ -0,0 +1,31 @@
+import React from 'react';
+import './index.css'
+
+
+export default function Modal() {
+
+ const handleSubmit = (e) => {
+ e.preventDefault();
+
+ }
+ return (
+
+ )
+}
diff --git a/src/components/singlePost/SinglePost.jsx b/src/components/singlePost/SinglePost.jsx
index 8ce8c05..560c294 100644
--- a/src/components/singlePost/SinglePost.jsx
+++ b/src/components/singlePost/SinglePost.jsx
@@ -4,6 +4,7 @@ import { useLocation, useNavigate } from 'react-router-dom'
import axios from 'axios';
import moment from 'moment';
import { Context } from '../../context/Context';
+import Modal from '../Modal';
export default function SinglePost() {
@@ -15,6 +16,10 @@ export default function SinglePost() {
const [post, setPost] = useState([]);
const [username, setUsername] = useState('');
+ const [title, setTitle] = useState('');
+ const [desc, setDesc] = useState('')
+ const [updateMode, setUpdateMode] = useState(false)
+
useEffect(() => {
const getPost = async () => {
const result = await axios.get(location.pathname);
@@ -43,7 +48,7 @@ export default function SinglePost() {
src={post.postThumbnail ? `http://localhost:3000/images/${post.postThumbnail}` : `https://dummyimage.com/250/ffffff/000000`} alt="" />
{post.title}
-
+ setUpdateMode(true)}>
@@ -55,6 +60,9 @@ export default function SinglePost() {
{post.description}
+ { updateMode &&
+
+ }
)
}
diff --git a/src/components/singlePost/singlePost.css b/src/components/singlePost/singlePost.css
index 1842025..170647a 100644
--- a/src/components/singlePost/singlePost.css
+++ b/src/components/singlePost/singlePost.css
@@ -1,5 +1,6 @@
.singlePost {
flex: 9;
+ /* position: relative; */
}
.singlePostWraper {
diff --git a/src/context/Actions.js b/src/context/Actions.js
index 1000bd9..68d7a5d 100644
--- a/src/context/Actions.js
+++ b/src/context/Actions.js
@@ -9,16 +9,17 @@ export const LoginSuccessfull = (user) => ({
})
export const LoginFailure = () => ({
- tyep: actionTypes.LOGIN_FAILURE
+ type: actionTypes.LOGIN_FAILURE
})
export const Logout = () => ({
- tyep: actionTypes.LOGOUT
+ type: actionTypes.LOGOUT
})
-export const FetchPosts = () => ({
- tyep: actionTypes.FETCH_POSTS
+export const UpdatePostModal = () => ({
+ type: actionTypes.UPDATE_POST_MODAL,
+ payload: true
})
diff --git a/src/context/Context.js b/src/context/Context.js
index c9d527c..c653009 100644
--- a/src/context/Context.js
+++ b/src/context/Context.js
@@ -4,7 +4,8 @@ import Reducer from "./Reducer";
const INITIAL_STATE = {
user: JSON.parse(localStorage.getItem("user")) || null,
isFetching: false,
- error: false
+ error: false,
+ updatePostModal: false
}
export const Context = createContext(INITIAL_STATE);
@@ -21,7 +22,8 @@ export const ContextProvider = ({ children }) => {
user: state.user,
isFetching: state.isFetching,
error: state.error,
- dispatch
+ dispatch,
+ updatePostModal:state.updatePostModal
}}
>
{children}
diff --git a/src/context/Reducer.js b/src/context/Reducer.js
index 26ed87a..ae05150 100644
--- a/src/context/Reducer.js
+++ b/src/context/Reducer.js
@@ -35,19 +35,8 @@ const Reducer = (state, action) => {
isFetching: false,
error: false
};
- // case actionTypes.REGISTER_SUCCESS:
- // return {
- // user: payload,
- // isFetching: false,
- // error: false
- // };
- // case actionTypes.REGISTER_FAILURE:
- // return {
- // user: null,
- // isFetching: false,
- // error: true
- // };
-
+ case actionTypes.UPDATE_POST_MODAL:
+ return payload;
default:
return state
diff --git a/src/context/constants.js b/src/context/constants.js
index 8f732dc..1ddecb6 100644
--- a/src/context/constants.js
+++ b/src/context/constants.js
@@ -4,7 +4,6 @@ export const LOGIN_FAILURE = 'LOGIN_FAILURE';
export const LOGOUT = 'LOGOUT';
export const FETCH_POSTS = 'FETCH_POSTS';
-export const REGISTER_SUCCESS = 'LOGIN_SUCCESS';
+export const UPDATE_POST_MODAL = 'UPDATE_POST_MODAL';
export const REGISTER_FAILURE = 'LOGIN_FAILURE';
-
diff --git a/src/pages/settings/settings.css b/src/pages/settings/settings.css
index ab3bdd5..1d2758b 100644
--- a/src/pages/settings/settings.css
+++ b/src/pages/settings/settings.css
@@ -81,4 +81,6 @@ cursor: pointer;
.settingSubmit:disabled{
background-color: rgb(97, 134, 134);
cursor: not-allowed;
-}
\ No newline at end of file
+}
+
+