sdy

change Message container style

1 import React from "react"; 1 import React from "react";
2 import styled from "styled-components"; 2 import styled from "styled-components";
3 -import { parse, format } from "date-fns"; 3 +import ProfileIcon from "./ProfileIcon";
4 4
5 const MessageWrapper = styled.div` 5 const MessageWrapper = styled.div`
6 display: flex; 6 display: flex;
7 - justify-content: flex-end; 7 + justify-content: flex-start;
8 align-items: center; 8 align-items: center;
9 padding: 20px 10px; 9 padding: 20px 10px;
10 margin-top: 20px; 10 margin-top: 20px;
...@@ -13,6 +13,11 @@ const MessageWrapper = styled.div` ...@@ -13,6 +13,11 @@ const MessageWrapper = styled.div`
13 13
14 const MsgContainer = styled.div` 14 const MsgContainer = styled.div`
15 display: flex; 15 display: flex;
16 + flex-direction: row;
17 +`;
18 +
19 +const ColumnBox = styled.div`
20 + display: flex;
16 flex-direction: column; 21 flex-direction: column;
17 `; 22 `;
18 23
...@@ -20,9 +25,7 @@ const MsgBox = styled.div` ...@@ -20,9 +25,7 @@ const MsgBox = styled.div`
20 display: flex; 25 display: flex;
21 justify-content: center; 26 justify-content: center;
22 align-items: center; 27 align-items: center;
23 - background-color: #54a0ff; 28 + color: black;
24 - color: white;
25 - border-radius: 20px;
26 margin-bottom: 10px; 29 margin-bottom: 10px;
27 `; 30 `;
28 31
...@@ -42,16 +45,19 @@ const Time = styled.span` ...@@ -42,16 +45,19 @@ const Time = styled.span`
42 font-size: 15px; 45 font-size: 15px;
43 `; 46 `;
44 47
45 -export default ({ text }) => { 48 +export default ({ text, avatar }) => {
46 return ( 49 return (
47 <MessageWrapper className="MessageWrapper"> 50 <MessageWrapper className="MessageWrapper">
48 <MsgContainer> 51 <MsgContainer>
49 - <MsgBox> 52 + <ProfileIcon avatar={avatar} />
50 - <Msg> {text} </Msg> 53 + <ColumnBox>
51 - </MsgBox> 54 + <MsgBox>
52 - <TimeBox> 55 + <Msg> {text} </Msg>
53 - <Time></Time> 56 + </MsgBox>
54 - </TimeBox> 57 + <TimeBox>
58 + <Time>1</Time>
59 + </TimeBox>
60 + </ColumnBox>
55 </MsgContainer> 61 </MsgContainer>
56 </MessageWrapper> 62 </MessageWrapper>
57 ); 63 );
......