Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 36x 36x 108x 31x 31x 5x 5x | // Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
class Component extends React.Component {
render() {
const className = classNames('slds-media', this.props.className, {
[`slds-media_${this.props.flavor}`]: this.props.flavor
});
return (
<div className={className}>
{this.renderFigure(
this.props.figureCenter,
classNames(
'slds-media__figure_stacked',
this.props.figureCenterClassName
)
)}
{this.renderFigure(
this.props.figureLeft,
this.props.figureLeftClassName
)}
<div className="slds-media__body">{this.props.children}</div>
{this.renderFigure(
this.props.figureRight,
classNames(
'slds-media__figure_reverse',
this.props.figureRightClassName
)
)}
</div>
);
}
renderFigure(figure, className) {
if (!figure) return null;
className = classNames('slds-media__figure', className);
return <div className={className}>{figure}</div>;
}
}
Component.displayName = 'MediaObject';
Component.propTypes = {
figureLeft: PropTypes.node,
figureLeftClassName: PropTypes.string,
figureRight: PropTypes.node,
figureRightClassName: PropTypes.string,
figureCenter: PropTypes.node,
figureCenterClassName: PropTypes.string,
flavor: PropTypes.oneOf(['center', 'small', 'stacked', 'responsive'])
};
export default Component;
|