1
- import React , { useState , } from 'react' ;
1
+ import React , { useState } from 'react' ;
2
2
import { useMutation } from '@apollo/client' ;
3
3
import {
4
4
ADD_LIKE ,
@@ -10,6 +10,9 @@ import {
10
10
import { withStyles , createStyles , makeStyles , Theme } from '@material-ui/core/styles' ;
11
11
import CloseIcon from '@material-ui/icons/Close' ;
12
12
import AddCommentIcon from '@material-ui/icons/AddComment' ;
13
+
14
+ import Button from '@material-ui/core/Button' ;
15
+
13
16
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder' ;
14
17
import FavoriteIcon from '@material-ui/icons/Favorite' ;
15
18
import StarIcon from '@material-ui/icons/Star' ;
@@ -102,6 +105,7 @@ const Project = ({
102
105
publishProject ( myVar ) ;
103
106
}
104
107
108
+
105
109
//Adds the comment to the project
106
110
function handleComment ( e ) {
107
111
e . preventDefault ( ) ;
@@ -116,13 +120,15 @@ const Project = ({
116
120
addComment ( myVar )
117
121
}
118
122
123
+
119
124
//sets state of commentVal to what the user types in to comment
120
125
function handleChange ( e ) {
121
126
e . preventDefault ( ) ;
122
127
let commentValue = e . target . value ;
123
128
setCommentVal ( commentValue ) ;
124
129
}
125
130
131
+
126
132
const recentComments = [ ] ;
127
133
if ( comments . length > 0 ) {
128
134
const reversedCommentArray = comments . slice ( 0 ) . reverse ( ) ;
@@ -136,13 +142,11 @@ const Project = ({
136
142
) }
137
143
}
138
144
139
- // ---Clear canvas functionality---
140
145
// Closes out the open modal
141
146
const closeModal = ( ) => setModal ( '' ) ;
142
147
143
- // Creates modal that asks if user wants to clear workspace
144
- // If user clears their workspace, then their components are removed from state and the modal is closed
145
- const clearWorkspace = ( ) => {
148
+ // Creates modal that asks if user wants to delete project
149
+ const deleteProjectModal = ( ) => {
146
150
//Deletes project from the database
147
151
const handleDelete = ( e ) => {
148
152
e . preventDefault ( ) ;
@@ -196,7 +200,7 @@ const Project = ({
196
200
< div className = 'project' >
197
201
< div className = 'header' >
198
202
{ currUsername === username ?
199
- < IconButton tooltip = "Delete Project" onClick = { clearWorkspace } style = { { position : 'absolute' , right : '0' } } >
203
+ < IconButton tooltip = "Delete Project" onClick = { deleteProjectModal } style = { { position : 'absolute' , right : '0' } } >
200
204
< CloseIcon />
201
205
</ IconButton >
202
206
: '' }
@@ -228,8 +232,8 @@ const Project = ({
228
232
{ recentComments }
229
233
</ div >
230
234
< div className = 'commentInput' >
231
- < input type = "text" placeholder = "Add Comment" onChange = { handleChange } > </ input >
232
- < AddCommentIcon className = 'commentBtn' fontSize = 'Large' onClick = { handleComment } style = { { position : 'absolute' , right : '0 ' , top : '10px ' } } />
235
+ < input type = "text" placeholder = "Add Comment" className = "commentField" onChange = { handleChange } > </ input >
236
+ < AddCommentIcon className = 'commentBtn' fontSize = 'Large' onClick = { handleComment } style = { { position : 'absolute' , right : '8 ' , top : '13 ' } } />
233
237
</ div >
234
238
{ modal }
235
239
</ div >
0 commit comments