11import React from 'react' ;
2- import styled from '@stream-io/styled-components' ;
2+ import styled , { withTheme } from '@stream-io/styled-components' ;
33
44import { renderText , capitalize } from '../../utils' ;
55
66const TextContainer = styled . View `
77 border-bottom-left-radius: ${ ( { theme, groupStyle } ) =>
88 groupStyle . indexOf ( 'left' ) !== - 1
9- ? theme . message . text . borderRadiusS
10- : theme . message . text . borderRadiusL } ;
9+ ? theme . message . content . textContainer . borderRadiusS
10+ : theme . message . content . textContainer . borderRadiusL } ;
1111 border-bottom-right-radius: ${ ( { theme, groupStyle } ) =>
1212 groupStyle . indexOf ( 'right' ) !== - 1
13- ? theme . message . text . borderRadiusS
14- : theme . message . text . borderRadiusL } ;
13+ ? theme . message . content . textContainer . borderRadiusS
14+ : theme . message . content . textContainer . borderRadiusL } ;
1515 border-top-left-radius: ${ ( { theme, groupStyle } ) =>
1616 groupStyle === 'leftBottom' || groupStyle === 'leftMiddle'
17- ? theme . message . text . borderRadiusS
18- : theme . message . text . borderRadiusL } ;
17+ ? theme . message . content . textContainer . borderRadiusS
18+ : theme . message . content . textContainer . borderRadiusL } ;
1919 border-top-right-radius: ${ ( { theme, groupStyle } ) =>
2020 groupStyle === 'rightBottom' || groupStyle === 'rightMiddle'
21- ? theme . message . text . borderRadiusS
22- : theme . message . text . borderRadiusL } ;
21+ ? theme . message . content . textContainer . borderRadiusS
22+ : theme . message . content . textContainer . borderRadiusL } ;
2323 margin-top: 2;
2424 padding: 5px;
2525 padding-left: 8;
@@ -28,20 +28,20 @@ const TextContainer = styled.View`
2828 alignment === 'left' ? 'flex-start' : 'flex-end' } ;
2929 border-width: ${ ( { theme, alignment } ) =>
3030 alignment === 'left'
31- ? theme . message . text . leftBorderWidth
32- : theme . message . text . rightBorderWidth } ;
31+ ? theme . message . content . textContainer . leftBorderWidth
32+ : theme . message . content . textContainer . rightBorderWidth } ;
3333 border-color: ${ ( { theme, alignment } ) =>
3434 alignment === 'left'
35- ? theme . message . text . leftBorderColor
36- : theme . message . text . rightBorderColor } ;
35+ ? theme . message . content . textContainer . leftBorderColor
36+ : theme . message . content . textContainer . rightBorderColor } ;
3737 background-color: ${ ( { theme, alignment, type, status } ) =>
3838 alignment === 'left' || type === 'error' || status === 'failed'
3939 ? theme . colors . transparent
4040 : theme . colors . light } ;
41- ${ ( { theme } ) => theme . message . text . css }
41+ ${ ( { theme } ) => theme . message . content . textContainer . css }
4242` ;
4343
44- export const MessageTextContainer = ( props ) => {
44+ export const MessageTextContainer = withTheme ( ( props ) => {
4545 const {
4646 message,
4747 groupStyles = [ 'bottom' ] ,
@@ -56,7 +56,9 @@ export const MessageTextContainer = (props) => {
5656 capitalize ( hasAttachment ? 'bottom' : groupStyles [ 0 ] ) ;
5757
5858 if ( ! message . text ) return false ;
59-
59+ const markdownStyles = props . theme
60+ ? props . theme . message . content . markdown
61+ : { } ;
6062 return (
6163 < React . Fragment >
6264 < TextContainer
@@ -66,11 +68,11 @@ export const MessageTextContainer = (props) => {
6668 type = { message . type }
6769 >
6870 { ! MessageText ? (
69- renderText ( message )
71+ renderText ( message , markdownStyles )
7072 ) : (
7173 < MessageText { ...props } renderText = { renderText } />
7274 ) }
7375 </ TextContainer >
7476 </ React . Fragment >
7577 ) ;
76- } ;
78+ } ) ;
0 commit comments