forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImage.js
More file actions
60 lines (49 loc) · 1.21 KB
/
Copy pathImage.js
File metadata and controls
60 lines (49 loc) · 1.21 KB
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
58
59
60
import classNames from 'classnames';
import React from 'react';
import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils';
const propTypes = {
/**
* Sets image as responsive image
*/
responsive: React.PropTypes.bool,
/**
* Sets image shape as rounded
*/
rounded: React.PropTypes.bool,
/**
* Sets image shape as circle
*/
circle: React.PropTypes.bool,
/**
* Sets image shape as thumbnail
*/
thumbnail: React.PropTypes.bool,
};
const defaultProps = {
responsive: false,
rounded: false,
circle: false,
thumbnail: false,
};
class Image extends React.Component {
render() {
const { responsive, rounded, circle, thumbnail, className, ...props } =
this.props;
const [bsProps, elementProps] = splitBsProps(props);
const classes = {
[prefix(bsProps, 'responsive')]: responsive,
[prefix(bsProps, 'rounded')]: rounded,
[prefix(bsProps, 'circle')]: circle,
[prefix(bsProps, 'thumbnail')]: thumbnail,
};
return (
<img
{...elementProps}
className={classNames(className, classes)}
/>
);
}
}
Image.propTypes = propTypes;
Image.defaultProps = defaultProps;
export default bsClass('img', Image);