Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 6x 6x 6x 1x 6x 1x 1x | import React from 'react' import styled from 'styled-components' import PropTypes from 'prop-types' const Wrapper = styled.div` text-align: ${(props) => props.align}; & > * { display: ${(props) => (props.inline ? 'inline' : 'block')}; margin-right: ${(props) => (props.inline ? '5px' : '0')}; } ` const TextGroup = ({ children, ...rest }) => ( <Wrapper {...rest}>{children}</Wrapper> ) TextGroup.propTypes = { align: PropTypes.oneOf(['justify', 'left', 'right', 'center']), children: PropTypes.node, inline: PropTypes.bool, } TextGroup.defaultProps = { align: 'justify', inline: true, } export default TextGroup |