diff --git a/src/App.js b/src/App.js
index c10859093..a73d97ee8 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,16 +1,29 @@
-import React from 'react';
+import React, { useState } from 'react';
import './App.css';
import chatMessages from './data/messages.json';
+import ChatLog from './components/ChatLog';
const App = () => {
+ const [totalLikes, setTotalLikes] = useState(0);
+
+ const likeChangeHandler = (liked) => {
+ if (liked) {
+ setTotalLikes((prevTotal) => prevTotal + 1);
+ } else {
+ setTotalLikes((prevTotal) => prevTotal - 1);
+ }
+ };
+
return (
-
Replace with name of sender
+
+
{props.sender}
- Replace with body of ChatEntry
- Replace with TimeStamp component
-
+ {props.body}
+
+
+
+
);
@@ -17,6 +34,10 @@ const ChatEntry = (props) => {
ChatEntry.propTypes = {
//Fill with correct proptypes
+ sender: PropTypes.string.isRequired,
+ body: PropTypes.string.isRequired,
+ timeStamp: PropTypes.string.isRequired,
+ onLikeChange: PropTypes.func.isRequired,
};
export default ChatEntry;
diff --git a/src/components/ChatLog.js b/src/components/ChatLog.js
new file mode 100644
index 000000000..ddcfceafe
--- /dev/null
+++ b/src/components/ChatLog.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import './ChatLog.css';
+import PropTypes from 'prop-types';
+import ChatEntry from './ChatEntry';
+
+const ChatLog = (props) => {
+ // console.log(props.onLikeChange)
+
+ const chatEntryComponents = props.entries.map((entry) => (
+
+ ));
+
+ return (
+
+
Conversation
+ {chatEntryComponents}
+
+ );
+};
+
+ChatLog.propTypes = {
+ entries: PropTypes.array.isRequired,
+ onLikeChange: PropTypes.func.isRequired,
+};
+
+export default ChatLog;
\ No newline at end of file