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

Amanda-Kaliane-Amethyst-C19-Chatlog #67

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

Conversation

MotifNoticer
Copy link

No description provided.

…yles to format Vladimir's messages on the left with light yellow background and Estragon's messages on the right with light blue background for Wave 1.
ted heart counter and toggle. All tests passing and project complete.
Comment on lines +9 to +17
const changeLiked = (id) => {
setEntries(prevEntries => {
const updatedEntries = prevEntries.map(entry => {

return entry.id === id ? { ...entry, liked: !entry.liked} : entry;
})
return updatedEntries;
})
}

Choose a reason for hiding this comment

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

Perfectly done! ⭐️

Comment on lines +19 to +25
const totalLiked = () => {
let total = 0;
for (let entry of entries) {
total += entry.liked ? 1 : 0;
}
return total;
}

Choose a reason for hiding this comment

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

💫

Comment on lines +13 to +19
// message = {message}
id={entry.id}
sender={entry.sender}
body={entry.body}
timeStamp={entry.timeStamp}
changeLiked={changeLiked}
liked={entry.liked}

Choose a reason for hiding this comment

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

Love how you kept the naming consistent as you passed down your props!

Comment on lines +32 to +42
ChatLog.propTypes = {
entries: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.number.isRequired,
sender: PropTypes.string.isRequired,
body: PropTypes.string.isRequired,
liked: PropTypes.bool.isRequired,
timeStamp: PropTypes.string.isRequired,
})
)
};

Choose a reason for hiding this comment

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

Y'all ate on this! Great Job!


const ChatEntry = (props) => {
const ChatEntry = ({ id, sender, body, timeStamp, changeLiked, liked }) => {
const side = sender === 'Vladimir' ? 'local' : 'remote';

Choose a reason for hiding this comment

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

The ternaries are great for situations like this right? They are the perfect tool to use when wanting conditionally apply styling!

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.

3 participants