MCPcopy
hub / github.com/elementalui/elemental / render

Function render

src/components/Col.js:43–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 });
42 },
43 render() {
44 let { basis, gutter, xs, sm, md, lg } = this.props;
45 let { windowWidth } = this.state;
46
47 let columnStyle = {
48 minHeight: 1,
49 paddingLeft: (gutter / 2),
50 paddingRight: (gutter / 2),
51 };
52
53 // if no width control is provided fill available space
54 if (!basis && !xs && !sm && !md && !lg) {
55 columnStyle.flex = '1 1 auto';
56 columnStyle.msFlex = '1 1 auto';
57 columnStyle.WebkitFlex = '1 1 auto';
58 }
59
60 // set widths / flex-basis
61 if (basis) {
62 columnStyle.flex = '1 0 ' + basis;
63 columnStyle.msFlex = '1 0 ' + basis;
64 columnStyle.WebkitFlex = '1 0 ' + basis;
65 } else if (windowWidth < E.breakpoint.xs) {
66 columnStyle.width = xs;
67 } else if (windowWidth < E.breakpoint.sm) {
68 columnStyle.width = sm || xs;
69 } else if (windowWidth < E.breakpoint.md) {
70 columnStyle.width = md || sm || xs;
71 } else {
72 columnStyle.width = lg || md || sm || xs;
73 }
74
75 if (!columnStyle.width) {
76 columnStyle.width = '100%';
77 }
78
79 if (columnStyle.width in E.fractions) {
80 columnStyle.width = E.fractions[columnStyle.width];
81 }
82
83 let props = blacklist(this.props, 'basis', 'gutter', 'style', 'xs', 'sm', 'md', 'lg');
84
85 return <div style={Object.assign(columnStyle, this.props.style)} {...props} />;
86 },
87});

Callers 3

FormSelect.jsFile · 0.70
Modal.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected