UNPKG

1.17 kBJavaScriptView Raw
1import React, {Component} from 'react';
2import PropTypes from 'prop-types';
3import classNames from 'classnames';
4
5import adaptiveIslandHOC from '../island/adaptive-island-hoc';
6import dataTests from '../global/data-tests';
7
8import styles from './island.css';
9
10/**
11 * @name Island
12 */
13
14export default class Island extends Component {
15 static propTypes = {
16 children: PropTypes.node,
17 className: PropTypes.string,
18 narrow: PropTypes.bool,
19 withoutPaddings: PropTypes.bool,
20 'data-test': PropTypes.string
21 };
22
23 render() {
24 // eslint-disable-next-line max-len
25 const {children, className, narrow, withoutPaddings, 'data-test': dataTest, ...restProps} = this.props;
26 const classes = classNames(styles.island, className, {
27 [styles.narrowIsland]: narrow,
28 [styles.withoutPaddings]: withoutPaddings
29 });
30
31 return (
32 <div
33 {...restProps}
34 className={classes}
35 data-test={dataTests('ring-island', dataTest)}
36 >
37 {children}
38 </div>
39 );
40 }
41}
42
43export const AdaptiveIsland = adaptiveIslandHOC(Island);
44
45export {default as Header} from './header';
46export {default as Content} from './content';