sdy

rename Message component

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 4
4 -const OutcomingBox = styled.div` 5 +const MessageWrapper = styled.div`
5 display: flex; 6 display: flex;
6 justify-content: flex-end; 7 justify-content: flex-end;
7 align-items: center; 8 align-items: center;
...@@ -43,15 +44,15 @@ const Time = styled.span` ...@@ -43,15 +44,15 @@ const Time = styled.span`
43 44
44 export default ({ time, text }) => { 45 export default ({ time, text }) => {
45 return ( 46 return (
46 - <OutcomingBox className="OutcomingMsg"> 47 + <MessageWrapper className="MessageWrapper">
47 <MsgContainer> 48 <MsgContainer>
48 <MsgBox> 49 <MsgBox>
49 - <Msg /> {text} Outcoming Message 50 + <Msg> {text} Outcoming Message </Msg>
50 </MsgBox> 51 </MsgBox>
51 <TimeBox> 52 <TimeBox>
52 - <Time /> {time} Monday 00:00 53 + <Time> {format(parse(time, "MM/DD/YYYY hh:mma"))} </Time>
53 </TimeBox> 54 </TimeBox>
54 </MsgContainer> 55 </MsgContainer>
55 - </OutcomingBox> 56 + </MessageWrapper>
56 ); 57 );
57 }; 58 };
......
1 -import React from "react";
2 -import styled from "styled-components";
3 -import ImgIconBox from "./ProfileIcon";
4 -
5 -const IncomingBox = styled.div`
6 - display: flex;
7 - flex-direction: row;
8 - width: 100%;
9 - padding: 20px 10px;
10 - margin-top: 20px;
11 - margin-left: 10px;
12 -`;
13 -
14 -const MsgContainer = styled.div`
15 - display: flex;
16 - flex-direction: column;
17 - margin-left: 10px;
18 -`;
19 -
20 -const MsgBox = styled.div`
21 - background-color: #20bf6b;
22 - color: white;
23 - display: flex;
24 - justify-content: center;
25 - align-items: center;
26 - border-radius: 20px;
27 - margin-bottom: 10px;
28 -`;
29 -
30 -const Msg = styled.span`
31 - font-size: 20px;
32 - padding: 20px 10px;
33 -`;
34 -
35 -const TimeBox = styled.div`
36 - display: flex;
37 - justify-content: flex-start;
38 - align-items: center;
39 - opacity: 0.7;
40 -`;
41 -
42 -const Time = styled.span`
43 - font-size: 15px;
44 -`;
45 -
46 -export default ({ time, text }) => {
47 - return (
48 - <IncomingBox className="IncomingMsg">
49 - <ImgIconBox />
50 - <MsgContainer>
51 - <MsgBox>
52 - <Msg /> {text} Incoming Message
53 - </MsgBox>
54 - <TimeBox>
55 - <Time /> {time} Monday 00:00
56 - </TimeBox>
57 - </MsgContainer>
58 - </IncomingBox>
59 - );
60 -};