Replace the div with your component and add span classes in the order that is shown below to get the masonry layout