@retailmenot/anchor
Version:
A React UI Library by RetailMeNot
43 lines • 2.32 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
// REACT
import * as React from 'react';
// VENDOR
import styled from '@xstyled/styled-components';
import classnames from 'classnames';
// Constants
// ------------------------------------------------------------------------------------------------------------------
export const DEFAULT_LAYOUT_WIDTH = '100%';
export const DEFAULT_CONTENT_WIDTH = '71.25rem';
export const TRANSPARENT = 'transparent';
// Styled Components
// ------------------------------------------------------------------------------------------------------------------
const StyledLayout = styled('section') `
max-width: ${props => props.layoutWidth};
background-color: ${props => props.layoutBackgroundColor};
margin: 0 auto;
`;
const StyledContent = styled('div') `
max-width: ${props => props.contentWidth};
background-color: ${props => props.contentBackgroundColor};
margin: 0 auto;
`;
StyledContent.displayName = 'StyledContent';
StyledLayout.displayName = 'StyledLayout';
// Components
// ------------------------------------------------------------------------------------------------------------------
export const Layout = (_a) => {
var { layoutWidth = DEFAULT_LAYOUT_WIDTH, layoutBackgroundColor = TRANSPARENT, contentWidth = DEFAULT_CONTENT_WIDTH, contentBackgroundColor = TRANSPARENT, className, children } = _a, props = __rest(_a, ["layoutWidth", "layoutBackgroundColor", "contentWidth", "contentBackgroundColor", "className", "children"]);
return (React.createElement(StyledLayout, Object.assign({ layoutWidth: layoutWidth, layoutBackgroundColor: layoutBackgroundColor, className: classnames('anchor-layout', className) }, props),
React.createElement(StyledContent, { contentWidth: contentWidth, contentBackgroundColor: contentBackgroundColor }, children)));
};
//# sourceMappingURL=Layout.component.js.map