Open
Conversation
added 11 commits
July 19, 2023 12:29
Destructure first message from chat data Pass first message props to ChatEntry Render ChatEntry component in main
Create ChatLog component Map over chatMessages array Pass props to ChatEntry for each message Render ChatLog in App instead of just ChatEntry Minor formatting fixes
- Imported and rendered ChatEntry component in App - Passed props for sender, body, and timestamp - Add className to wrap div for styling - Render sender name, message body, and timestamp - Add PropTypes validation
- Add state to track total likes - Pass handler to increment likes to ChatLog - Display total likes
- Pass like handler to ChatEntry and increment likes in App - Lift like state up to App and pass to ChatLog and ChatEntry - Update ChatEntry to toggle like on click and call handler - Conditionally render heart icon based on like state - Add total likes display in App showing count - Fix bug where like state not persisting on re-render
…ddress test failures.
nancy-harris
left a comment
There was a problem hiding this comment.
Excellent job! There are some comments below on places where some changes caused CSS styling to get lost. Great job!
| </div> | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
This would have been a great place for prop types!
| return ( | ||
| <div className="chat-entry local"> | ||
| <h2 className="entry-name">Replace with name of sender</h2> | ||
| <section className="entry-bubble"> |
There was a problem hiding this comment.
It looks like this section element was removed. Since it had a class attached to it, it provided specific CSS styling that helped design the page.
| <h2 className="entry-name">Replace with name of sender</h2> | ||
| <section className="entry-bubble"> | ||
| <p>Replace with body of ChatEntry</p> | ||
| <p className="entry-time">Replace with TimeStamp component</p> |
There was a problem hiding this comment.
It looks like the class entry-time was removed. This provided specific CSS styling for the timestamp.
| import chatMessages from './data/messages.json'; | ||
| import ChatLog from './components/ChatLog'; | ||
|
|
||
| const App = () => { |
| ); | ||
| }; | ||
|
|
||
| ChatEntry.propTypes = { |
| import './ChatLog.css'; | ||
| import ChatEntry from './ChatEntry'; | ||
|
|
||
| const ChatLog = (props) => { |
| import TimeStamp from './TimeStamp'; | ||
| import './ChatEntry.css'; | ||
|
|
||
| const ChatEntry = (props) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
React is cute. This was Cute.