Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolves bug & rearranges rendering of individual cards #19

Merged
merged 2 commits into from
Jul 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions src/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';

const Card = (props) => {

const [newMessage, setNewMessage] = useState({'message': ''});
const [newMessage, setNewMessage] = useState({'message': props.message});

const [showEditBox, setShowEditBox] = useState(false)

Expand Down Expand Up @@ -38,23 +38,22 @@ const Card = (props) => {

return (

<section>
<ul>
<li>Sticky Note: { props.id }</li>
<li>Board ID: { props.boardId }</li>
<button type='button' onClick={upvoteClick}> Upvote: {props.likesCount}</button>
<button type='button' onClick={deleteCardClick}>Delete</button>
<>
{showEditBox ? (
<>
<textarea defaultValue={props.message} onChange={ onMessageChange }></textarea>
<button onClick={() => onSubmitMessage(newMessage)}>Save</button>
</>
) : <li>Message: { props.message }</li>}
</>
<button type='button' onClick={editButtonClick}>Edit</button>
</ul>
</section>
<section>
<ul>
<>
{showEditBox ? (
<>
<textarea defaultValue={props.message} onChange={ onMessageChange }></textarea>
<button onClick={() => onSubmitMessage(newMessage)}>Save</button>
</>
) : <li>Message: { props.message }</li>}
</>
<button type='button' onClick={upvoteClick}> Upvote: {props.likesCount}</button>
<button type='button' onClick={deleteCardClick}>Delete</button>
<button type='button' onClick={editButtonClick}>Edit</button>
</ul>
</section>


)
}
Expand Down