adaptiv-ui
Version:
a library of styled components with some global style overrides in sass
90 lines (81 loc) • 2.01 kB
JavaScript
import styled from "styled-components";
import {
sideways,
longways,
flexWrap,
boxSize,
marg,
pad,
columnDirection,
flexJustify,
centerAlign,
flexContent,
textAlign
} from "../maps";
import PropTypes from "prop-types";
const Form = styled.form`
display: flex;
flex-wrap: ${flexWrap};
flex-direction: ${props =>
props.direction ? props.direction : columnDirection};
justify-content: ${props => (props.justify ? props.justify : flexJustify)};
align-items: ${props => (props.align ? props.align : centerAlign)};
align-content: ${props => (props.content ? props.content : flexContent)};
color: ${props => (props.color ? props.color : "auto")};
background: ${props => (props.bg ? props.bg : "none")};
height: ${props => (props.h ? props.h : props.sqr ? props.sqr : longways)};
width: ${props => (props.w ? props.w : props.sqr ? props.sqr : sideways)};
padding: ${props => (props.p ? props.p : pad)};
margin: ${props => (props.m ? props.m : marg)};
box-sizing: ${props => (props.box_size ? props.box_size : boxSize)};
text-align: ${textAlign};
`;
export default Form;
Form.propTypes = {
// CUSTOM PROPTYPES
direction: PropTypes.oneOf([
"row",
"row-reverse",
"column",
"column-reverse"
]),
justify: PropTypes.oneOf([
"flex-start",
"flex-end",
"center",
"space-between",
"space-around",
"space-evenly"
]),
align: PropTypes.oneOf([
"stretch",
"flex-start",
"flex-end",
"center",
"baseline"
]),
content: PropTypes.oneOf([
"stretch",
"flex-start",
"flex-end",
"center",
"baseline"
]),
wrap: PropTypes.oneOf([
"nowrap",
"wrap",
"wrap-reverse",
"initial",
"inherit"
]),
h: PropTypes.string,
w: PropTypes.string,
background: PropTypes.string,
min_h: PropTypes.string,
max_w: PropTypes.string,
p: PropTypes.string,
m: PropTypes.string,
opacity: PropTypes.string,
box_size: PropTypes.string,
color: PropTypes.string
};