forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMediaLeft.js
More file actions
38 lines (30 loc) · 912 Bytes
/
MediaLeft.js
File metadata and controls
38 lines (30 loc) · 912 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
38
import classNames from 'classnames';
import React from 'react';
import Media from './Media';
import { bsClass, getClassSet, prefix, splitBsProps }
from './utils/bootstrapUtils';
const propTypes = {
/**
* Align the media to the top, middle, or bottom of the media object.
*/
align: React.PropTypes.oneOf(['top', 'middle', 'bottom']),
};
class MediaLeft extends React.Component {
render() {
const { align, className, ...props } = this.props;
const [bsProps, elementProps] = splitBsProps(props);
const classes = getClassSet(bsProps);
if (align) {
// The class is e.g. `media-top`, not `media-left-top`.
classes[prefix(Media.defaultProps, align)] = true;
}
return (
<div
{...elementProps}
className={classNames(className, classes)}
/>
);
}
}
MediaLeft.propTypes = propTypes;
export default bsClass('media-left', MediaLeft);