-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ddfa23
commit 0f5092d
Showing
11 changed files
with
246 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
client/src/components/Messages/Conversation/elements/Message.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
|
||
import { formatTime } from '../../../../utils/timestamp'; | ||
import { formatMultiLineText } from '../../../../utils/style-utils'; | ||
|
||
const Message = (props) => { | ||
const { partner } = props; | ||
|
||
const sender = props.sender === partner._id | ||
? `${partner.firstname} ${partner.lastname}` | ||
: 'Me'; | ||
|
||
const selfMessage = sender === 'Me'; | ||
|
||
return ( | ||
<Wrapper self={selfMessage}> | ||
<Info> | ||
<Partner self={selfMessage}>{sender}</Partner> | ||
<Timestamp>{formatTime(props.timestamp, true)}</Timestamp> | ||
</Info> | ||
<Text self={selfMessage}>{formatMultiLineText(props.text)}</Text> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const { string, shape } = PropTypes; | ||
Message.propTypes = { | ||
timestamp: string.isRequired, | ||
partner: shape({ | ||
_id: string.isRequired, | ||
firstname: string.isRequired, | ||
lastname: string.isRequired | ||
}).isRequired, | ||
sender: string.isRequired, | ||
text: string.isRequired | ||
}; | ||
|
||
const Info = styled.div` | ||
display: flex; | ||
margin-bottom: 3px; | ||
`; | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
flex: none; | ||
flex-direction: column; | ||
justify-content: center; | ||
background-color: e2edff; | ||
align-self: ${props => props.self === true ? 'flex-end' : 'flex-start'} | ||
margin: 10px 20px; | ||
max-width: 80%; | ||
`; | ||
|
||
const Partner = styled.div` | ||
margin-left: 5px; | ||
margin-right: 15px; | ||
font-size: 13px; | ||
color: rgba(0, 0, 0, 0.7); | ||
`; | ||
|
||
const Timestamp = styled.div` | ||
color: rgba(0, 0, 0, .40) | ||
font-size: 11px; | ||
margin-right: 5px; | ||
margin-left: auto; | ||
`; | ||
|
||
const Text = styled.div` | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
padding: 5px 10px; | ||
border-radius: 7px; | ||
background-color: ${props => props.self === true ? '#f1f0f0' : props.theme.primary}; | ||
color: ${props => props.self === true ? props.theme.black : props.theme.white}; | ||
justify-content: center; | ||
`; | ||
|
||
export default Message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
client/src/components/Schedule/Table/elements/InfoColumn.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import { HOURS } from '../../../../utils/constants'; | ||
import { media } from '../../../../utils/style-utils'; | ||
|
||
const InfoColumn = () => ( | ||
<Wrapper> | ||
<Info annotation>Day</Info> | ||
<Info annotation>Semigroup</Info> | ||
<Info annotation>Week</Info> | ||
{HOURS.map(h => <Info key={h.key}>{h.text}</Info>)} | ||
</Wrapper> | ||
); | ||
|
||
const Wrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
min-width: 8vw; | ||
${media.tablet` | ||
display: none | ||
`} | ||
`; | ||
|
||
const Info = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
text-align: center; | ||
border-bottom: ${props => props.theme.separator}; | ||
height: 40px; | ||
font-weight: ${props => props.annotation && 'bolder'}; | ||
`; | ||
|
||
export default InfoColumn; |
Oops, something went wrong.