-
Notifications
You must be signed in to change notification settings - Fork 117
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
Submission pull request #115
base: main
Are you sure you want to change the base?
Conversation
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the class entry-time
was removed. This provided specific CSS styling for the timestamp.
import './App.css'; | ||
import chatMessages from './data/messages.json'; | ||
import ChatLog from './components/ChatLog'; | ||
|
||
const App = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
<TimeStamp time={props.timeStamp} /> | ||
<button className="like" onClick={toggleLiked}> | ||
{liked ? '❤️' : '🤍'} | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
ChatEntry.propTypes = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, prop types!
import './ChatLog.css'; | ||
import ChatEntry from './ChatEntry'; | ||
|
||
const ChatLog = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
import PropTypes from 'prop-types'; | ||
import TimeStamp from './TimeStamp'; | ||
import './ChatEntry.css'; | ||
|
||
const ChatEntry = (props) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
React is cute. This was Cute.