34 lines
814 B
JavaScript
Raw Normal View History

2019-10-15 18:32:19 +02:00
import React from 'react';
import PropTypes from 'prop-types';
2019-10-16 16:53:53 +02:00
import GrabIcon from '../../icons/GrabIcon';
import RemoveIcon from '../../icons/RemoveIcon';
2019-10-15 18:32:19 +02:00
import Wrapper from './Wrapper';
2019-10-16 19:59:00 +02:00
const DraggedField = ({ count, name, onRemove }) => {
2019-10-15 18:32:19 +02:00
return (
2019-10-16 19:59:00 +02:00
<Wrapper count={count}>
2019-10-16 16:00:24 +02:00
<div className="sub_wrapper">
<div className="grab">
2019-10-16 16:53:53 +02:00
<GrabIcon style={{ marginRight: 10, cursor: 'move' }} />
2019-10-16 16:00:24 +02:00
</div>
<div className="name">{name}</div>
2019-10-16 16:53:53 +02:00
<div className="remove" onClick={onRemove}>
<RemoveIcon />
</div>
2019-10-16 16:00:24 +02:00
</div>
2019-10-15 18:32:19 +02:00
</Wrapper>
);
};
2019-10-16 19:59:00 +02:00
DraggedField.defaultProps = {
count: 1,
};
2019-10-15 18:32:19 +02:00
DraggedField.propTypes = {
2019-10-16 19:59:00 +02:00
count: PropTypes.number,
2019-10-15 18:32:19 +02:00
name: PropTypes.string.isRequired,
2019-10-16 16:53:53 +02:00
onRemove: PropTypes.func.isRequired,
2019-10-15 18:32:19 +02:00
};
export default DraggedField;