File tree Expand file tree Collapse file tree 6 files changed +26
-13
lines changed
components/Conversation/components/Messages Expand file tree Collapse file tree 6 files changed +26
-13
lines changed Original file line number Diff line number Diff line change 1818 images : {
1919 dims : {
2020 width : null ,
21- height : null ,
21+ height : 200
2222 }
2323 }
2424 }
Original file line number Diff line number Diff line change @@ -5,17 +5,20 @@ import './styles.scss';
55
66class ImgReply extends PureComponent {
77 render ( ) {
8- const message = this . props . message ;
9- const title = message . get ( 'title' ) ;
10- const image = message . get ( 'image' ) ;
11- const params = message . get ( 'params' ) ;
8+ const { params : { images : { dims = { } } = { } } } = this . props ;
9+ const { width, height } = dims ;
10+ // Convert map to object
11+ const message = [ ...this . props . message . entries ( ) ] . reduce ( ( acc , e ) => (
12+ acc [ e [ 0 ] ] = e [ 1 ] ,
13+ acc ) , { } ) ;
14+ const { title, image } = message ;
1215 return (
1316 < div className = "image" >
1417 < b className = "image-title" >
1518 { title }
1619 </ b >
17- < div className = "image-details" >
18- < img className = "imageFrame" style = { { objectFit : "cover" , width : params . dims . width , height : params . dims . height } } src = { image } />
20+ < div className = "image-details" style = { { width , height } } >
21+ < img className = "image-frame" src = { image } />
1922 </ div >
2023 </ div >
2124 ) ;
@@ -26,4 +29,8 @@ ImgReply.propTypes = {
2629 message : PROP_TYPES . IMGREPLY
2730} ;
2831
32+ ImgReply . defaultProps = {
33+ params : { }
34+ }
35+
2936export default ImgReply ;
Original file line number Diff line number Diff line change 11@import " variables.scss" ;
22@import " common.scss" ;
33
4- .imageFrame {
5- object-fit : cover ;
4+ .image-details {
5+ object-fit : scale-down ;
66 max-width : 100% ;
77 margin-top : 10px ;
88}
9+
10+ .image-frame {
11+ object-position : 0 0 ;
12+ object-fit : cover ;
13+ width : 100% ;
14+ height : 100% ;
15+ }
Original file line number Diff line number Diff line change @@ -20,11 +20,12 @@ class Messages extends Component {
2020 }
2121
2222 getComponentToRender = ( message , index , isLast ) => {
23+ const { params } = this . props ;
2324 const ComponentToRender = message . get ( 'component' ) ;
2425 if ( message . get ( 'type' ) === 'component' ) {
2526 return < ComponentToRender id = { index } { ...message . get ( 'props' ) } isLast = { isLast } /> ;
2627 }
27- return < ComponentToRender id = { index } message = { message } isLast = { isLast } /> ;
28+ return < ComponentToRender id = { index } params = { params } message = { message } isLast = { isLast } /> ;
2829 } ;
2930
3031 render ( ) {
Original file line number Diff line number Diff line change @@ -67,8 +67,7 @@ class Widget extends Component {
6767 const element = message . attachment . payload ;
6868 this . props . dispatch ( addImageSnippet ( {
6969 title : element . title ,
70- image : element . src ,
71- params : this . props . params . images
70+ image : element . src
7271 } ) ) ;
7372 }
7473 }
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ export function createImageSnippet(image, sender) {
4747 component : Image ,
4848 title : image . title ,
4949 image : image . image ,
50- params : image . params ,
5150 sender,
5251 showAvatar : true
5352 } ) ;
You can’t perform that action at this time.
0 commit comments