From acd08e1d8957b9b4789682b82760c46309c9bee7 Mon Sep 17 00:00:00 2001 From: Lilian Mora Date: Fri, 20 Jan 2023 22:25:27 -0800 Subject: [PATCH 1/3] chatlog --- src/components/ChatEntry.js | 19 +++++++++++++------ src/components/ChatLog.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 src/components/ChatLog.js diff --git a/src/components/ChatEntry.js b/src/components/ChatEntry.js index b92f0b7b..293372f8 100644 --- a/src/components/ChatEntry.js +++ b/src/components/ChatEntry.js @@ -1,22 +1,29 @@ import React from 'react'; import './ChatEntry.css'; +import TimeStamp from './TimeStamp'; import PropTypes from 'prop-types'; -const ChatEntry = (props) => { +const ChatEntry = ({sender, body, timeStamp, changeLikes }) => { return (
-

Replace with name of sender

+

{sender}

-

Replace with body of ChatEntry

-

Replace with TimeStamp component

- +

{body}

+

+ +

); }; ChatEntry.propTypes = { - //Fill with correct proptypes + sender: PropTypes.string.isRequired, + body: PropTypes.string.isRequired, + timeStamp: PropTypes.string.isRequired, + changeLikes: PropTypes.func.isRequired, }; export default ChatEntry; + + diff --git a/src/components/ChatLog.js b/src/components/ChatLog.js new file mode 100644 index 00000000..953b44c1 --- /dev/null +++ b/src/components/ChatLog.js @@ -0,0 +1,30 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import ChatEntry from './ChatEntry'; +import './ChatLog.css'; + +const ChatLog = ({entries}) => { + const chatEntries = entries.map((entry) => { + return ( + + ); + }); + return
{chatEntries}
; +}; + +ChatLog.propTypes = { + entries: PropTypes.arrayOf( + PropTypes.shape({ + sender: PropTypes.string.isRequired, + body: PropTypes.string.isRequired, + timeStamp: PropTypes.string.isRequired + }) + ) +}; + +export default ChatLog; \ No newline at end of file From 2f54161f608c18c2f3bdc291f7b40795d7ce3203 Mon Sep 17 00:00:00 2001 From: Lilian Mora Date: Sat, 21 Jan 2023 13:32:53 -0800 Subject: [PATCH 2/3] 1 --- src/components/ChatEntry.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/ChatEntry.js b/src/components/ChatEntry.js index 293372f8..8bcfa710 100644 --- a/src/components/ChatEntry.js +++ b/src/components/ChatEntry.js @@ -3,7 +3,7 @@ import './ChatEntry.css'; import TimeStamp from './TimeStamp'; import PropTypes from 'prop-types'; -const ChatEntry = ({sender, body, timeStamp, changeLikes }) => { +const ChatEntry = ({sender, body, timeStamp}) => { return (

{sender}

@@ -21,7 +21,6 @@ ChatEntry.propTypes = { sender: PropTypes.string.isRequired, body: PropTypes.string.isRequired, timeStamp: PropTypes.string.isRequired, - changeLikes: PropTypes.func.isRequired, }; export default ChatEntry; From 10c92a471b49d17993efc71a744b33993ebf7767 Mon Sep 17 00:00:00 2001 From: Lilian Mora Date: Sat, 21 Jan 2023 13:34:36 -0800 Subject: [PATCH 3/3] 2 --- src/components/ChatLog.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ChatLog.js b/src/components/ChatLog.js index 953b44c1..024e20f2 100644 --- a/src/components/ChatLog.js +++ b/src/components/ChatLog.js @@ -7,7 +7,6 @@ const ChatLog = ({entries}) => { const chatEntries = entries.map((entry) => { return (