import React, { HTMLAttributes } from 'react'; import styled from 'styled-components'; import Col from '../Grid/Col'; import Row from '../Grid/Row'; export interface DividerProps extends HTMLAttributes { children?: React.ReactNode; position?: 'left' | 'right' | 'center'; offset?: number; } const DividerStyled = styled.div` padding: 16px 0; display: flex; align-items: center; > .inner { height: 22px; flex-grow: 10; display: flex; align-items: center; } `; const Divider: React.FC = (props) => { const { children, position, offset, ...rest } = props; const render = () => { if (position === 'left') { return (
{children}
); } if (position === 'center') { return (
{children}
); } if (position === 'right') { return (
{children}
); } }; return (
{render()}
); }; Divider.defaultProps = { children: '', position: 'center', offset: 0 }; export default Divider;