Reputation: 1316
I am working on a card-based UI with brick layout. I am using semantic-ui-react for the card components and react-packery-component for the masonary layout.
My react component is this.
import React from 'react';
import DisplayHomePageCardStructure from
'./DisplayHomePageCardStructure.jsx';
import {Grid} from 'semantic-ui-react';
const Packery = require('react-packery-component')(React);
let packeryOptions = {
// transitionDuration: 0,
gutter: 20
};
class DisplayHomePageCard extends React.Component {
constructor() {
super();
}
render() {
/* Getting the values from Mongo db*/
let Data = this.props.display.map(function(item) {
return (
<Grid.Column>
<DisplayHomePageCardStructure id={item.id} displayImage=
{item.displayImage}
heading={item.heading} question={item.question} postedBy=
{item.postedBy}
addedOn={item.addedOn} category={item.category} upVotes=
{item.upVotes}
downVotes={item.downVotes} answerCounts={item.answerCounts} '
views={item.views}
profileImage={item.profileImage}
/>
</Grid.Column>
);
});
return (
<Packery
elementType={'div'} options={packeryOptions} className = 'packery'>
{Data}
</Packery>
);
}
}
DisplayHomePageCard .propTypes = {
display: React.PropTypes.func
};
module.exports = DisplayHomePageCard;
As explained in https://github.com/eiriklv/react-packery-component, I'm getting the masonary layout as expected, similar to http://www.hearsay.me/.
I now want to implement drag-and-drop of my cards, somrthing functionally similiar to http://packery.metafizzy.co/draggable.html#jquery-ui-draggable
I need advice on how to achieve this. Can it be done via React only (without JQuery)? If I need to use JQuery, how should I do it?
Upvotes: 0
Views: 6884