-
Notifications
You must be signed in to change notification settings - Fork 182
/
island.tsx
59 lines (49 loc) · 1.36 KB
/
island.tsx
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
import React, {Component, HTMLAttributes} from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import dataTests from '../global/data-tests';
import adaptiveIslandHOC from './adaptive-island-hoc';
import styles from './island.css';
export interface IslandProps extends HTMLAttributes<HTMLElement> {
narrow?: boolean | null | undefined
withoutPaddings?: boolean | null | undefined
'data-test'?: string | null | undefined
}
/**
* @name Island
*/
export default class Island extends Component<IslandProps> {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
narrow: PropTypes.bool,
withoutPaddings: PropTypes.bool,
'data-test': PropTypes.string
};
render() {
const {
children,
className,
narrow,
withoutPaddings,
'data-test': dataTest,
...restProps
} = this.props;
const classes = classNames(styles.island, className, {
[styles.narrowIsland]: narrow,
[styles.withoutPaddings]: withoutPaddings
});
return (
<div
{...restProps}
className={classes}
data-test={dataTests('ring-island', dataTest)}
>
{children}
</div>
);
}
}
export const AdaptiveIsland = adaptiveIslandHOC(Island);
export {default as Header} from './header';
export {default as Content} from './content';