-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathMediaObject.js
More file actions
37 lines (33 loc) · 974 Bytes
/
MediaObject.js
File metadata and controls
37 lines (33 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
export default class MediaObject extends Component {
renderFigure(figure, className) {
if (!figure) return null;
return (
<div className={classNames('slds-media__figure', className)}>
{figure}
</div>
);
}
render() {
const { figureLeft, figureRight, figureCenter, children } = this.props;
const className = 'slds-media';
return (
<div className={className}>
{this.renderFigure(figureCenter, 'slds-media__figure--stacked')}
{this.renderFigure(figureLeft)}
<div className={'slds-media__body'}>
{children}
</div>
{this.renderFigure(figureRight, 'slds-media__figure--reverse')}
</div>
);
}
}
MediaObject.propTypes = {
figureLeft: PropTypes.node,
figureRight: PropTypes.node,
figureCenter: PropTypes.node,
children: PropTypes.node,
};