Changeset 2fcbde4
- Timestamp:
- 08/23/22 13:31:02 (2 years ago)
- Branches:
- main
- Children:
- 62b653f
- Parents:
- 6221ab6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
reactapp/src/Components/OpinionTree.js
r6221ab6 r2fcbde4 35 35 const [replyContent, setReplyContent] = useState(""); 36 36 37 const [postForModal, setPostForModal] = useState(null); 38 37 39 const handleLike = () => { 38 40 if (auth) { … … 51 53 }; 52 54 53 const handleReply = ( ) => {55 const handleReply = (opinion) => { 54 56 if (auth) { 55 57 setReplyModalDisplay("block"); 58 setPostForModal(opinion); 56 59 } else { 57 60 navigate("/login"); … … 120 123 right={90 + "px"} 121 124 color="black" 122 onClick={ handleReply} //todo125 onClick={() => handleReply(child)} 123 126 /> 124 127 </> … … 144 147 return ( 145 148 <div key={opinion.postId}> 146 <Modal display={replyModalDisplay}>147 <ModalContent>148 <ModalHeader>149 <ModalClose onClick={handleModalCloseClick}>150 ×151 </ModalClose>152 <h3 style={{ marginTop: "5px" }}>153 Реплика на {opinion.author.username}154 </h3>155 </ModalHeader>156 <form onSubmit={(e) => handleReplySubmit(e, opinion.postId)}>157 <ModalBody>158 <label htmlFor="content">159 <b>Содржина</b>:160 <ModalTextarea161 id="content"162 rows="8"163 cols="100"164 value={replyContent}165 onChange={handleContentChange}166 />167 </label>168 </ModalBody>169 <ModalFooter type="submit">РЕПЛИЦИРАЈ</ModalFooter>170 </form>171 </ModalContent>172 </Modal>173 149 <OpinionCard> 174 150 <OpinionCardContent> … … 203 179 right={90 + "px"} 204 180 color="black" 205 onClick={ handleReply}181 onClick={() => handleReply(opinion)} 206 182 /> 207 183 </> … … 216 192 } 217 193 })} 194 {postForModal && ( 195 <Modal display={replyModalDisplay}> 196 <ModalContent> 197 <ModalHeader> 198 <ModalClose onClick={handleModalCloseClick}>×</ModalClose> 199 <h3 style={{ marginTop: "5px" }}> 200 Реплика на {postForModal.author.username} 201 </h3> 202 </ModalHeader> 203 <form onSubmit={(e) => handleReplySubmit(e, postForModal.postId)}> 204 <ModalBody> 205 <label htmlFor="content"> 206 <b>Содржина</b>: 207 <ModalTextarea 208 id="content" 209 rows="8" 210 cols="100" 211 value={replyContent} 212 onChange={handleContentChange} 213 /> 214 </label> 215 </ModalBody> 216 <ModalFooter type="submit">РЕПЛИЦИРАЈ</ModalFooter> 217 </form> 218 </ModalContent> 219 </Modal> 220 )} 218 221 </div> 219 222 );
Note:
See TracChangeset
for help on using the changeset viewer.