Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80551 views
1
import React from 'react';
2
import SuitCSS from 'react-suitcss';
3
import { pascal } from 'case';
4
5
const View = React.createClass({
6
render() {
7
const {
8
component,
9
flexDirection,
10
alignItems,
11
justifyContent,
12
...props} = this.props;
13
14
if (flexDirection) {
15
props[`flexDirection${pascal(flexDirection)}`] = true;
16
}
17
18
if (alignItems) {
19
props[`alignItems${pascal(alignItems)}`] = true;
20
}
21
22
if (justifyContent) {
23
props[`justifyContent${pascal(justifyContent)}`] = true;
24
}
25
26
return (
27
<SuitCSS
28
{...props}
29
componentName="View"
30
element={component}
31
modifiers={[
32
'flexDirectionColumn',
33
'alignItemsFlexEnd',
34
'justifyContentFlexEnd',
35
'flexGrow',
36
]}
37
/>
38
);
39
}
40
});
41
42
View.defaultProps = {
43
component: 'div',
44
};
45
46
export default View;
47
48