1
0
Fork 0

Updated Blockquote component to take data-test attributes

This commit is contained in:
Joost De Cock 2019-08-17 18:18:19 +02:00
parent 4a1070f900
commit 112ead9796

View file

@ -1,25 +1,28 @@
import React from "react"; import React from 'react'
import PropTypes from "prop-types"; import PropTypes from 'prop-types'
import Icon from "../Icon"; import Icon from '../Icon'
const Blockquote = ({ type, children, style }) => { const Blockquote = props => {
const attr = Object.assign({}, props)
delete attr.type
delete attr.children
return ( return (
<blockquote className={type} style={style}> <blockquote className={props.type} {...attr}>
{children} {props.children}
<Icon icon={type} className={"icon " + type} /> <Icon icon={props.type} className={'icon ' + props.type} />
</blockquote> </blockquote>
); )
}; }
Blockquote.propTypes = { Blockquote.propTypes = {
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
children: PropTypes.node, children: PropTypes.node,
style: PropTypes.object style: PropTypes.object
}; }
Blockquote.defaultProps = { Blockquote.defaultProps = {
type: "note", type: 'note',
children: null, children: null,
style: {} style: {}
}; }
export default Blockquote; export default Blockquote