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

Submission pull request #115

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Submission pull request #115

wants to merge 11 commits into from

Conversation

MoyoMoz
Copy link

@MoyoMoz MoyoMoz commented Jul 20, 2023

React is cute. This was Cute.

Moyo Moz 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
Copy link

@nancy-harris nancy-harris left a 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>
);
}

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">

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>

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 = () => {

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 = {

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) => {

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) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants