Skip to content

Instantly share code, notes, and snippets.

@audacioustux
Created July 7, 2018 17:07
Show Gist options
  • Select an option

  • Save audacioustux/3d0ebfe2d38afe5624404811b2107b3b to your computer and use it in GitHub Desktop.

Select an option

Save audacioustux/3d0ebfe2d38afe5624404811b2107b3b to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import PropTypes from 'prop-types';
class Flex extends Component {
render() {
const {
children,
element,
// display,
// colBase,
// justifyContent,
// wrap,
// reverse,
// column
} = this.props;
return (
<{element}>{ children }</{element}>
);
}
}
Flex.propTypes = {
display: PropTypes.oneOf(['flex', 'inline-flex']),
element: PropTypes.oneOf([
'article',
'aside',
'div',
'figure',
'footer',
'header',
'main',
'nav',
'section',
]),
gap: PropTypes.number,
colBase: PropTypes.number,
justifyContent: PropTypes.oneOf(
[
'flex-start',
'flex-end',
'center',
'space-between',
'space-around',
'initial',
'inherit'
]
),
wrap: PropTypes.bool,
reverse: PropTypes.bool,
column: PropTypes.bool
};
Flex.defaultProps = {
display: 'flex',
element: 'div',
};
export default Flex;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment