Developer forum

Forum » Rapido » Feature request Paragraph container

Feature request Paragraph container

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

I have tried to make it work, but not sure if it is possible with the current setup using "Paragraph container" item type.

This is my desired setup (Screenshot 1).
But this is how it look in DW (Screenshot 2).

Would be really great to make the elements float and fit into place.
I did make it work by setting CSS style position = absolute on element C, but that is a hack that breaks the responsive design.

 

Screen1.png Screen2.png Screen3.png Screen4.png

Replies

 
Nicolai Pedersen
Reply

Hi Martin

Thank you for the input. We will look into if this should be introduced. Otherwise it is possible to change your custom css as you did or implement your own version of the paragraph container. As long as you give it another name, you can still upgrade you solution with new Rapido stuff in it.

Thanks, Nicolai

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply
This post has been marked as an answer

Hi Martin

Take caution, these kind of layouts, some call them masonry, is quite hard to get to work properly. Especially while trying to be responsive.

It sets high requirements for the content in each paragraph. For example, to look great, all four paragraphs on the left side must have exactly the half of the height of the paragraph on the right side. Minus the spacing between the paragraphs. And especially while still remaining responsive.

I would like to propose a custom solution that may work for you. What you could do, is make a special paragraph container for this special layout. 

I will try to describe the basic concepts for you to work on. I have not tested them, so there may be more to do. But if you can grasp the concept, I think it should be possible. And you may also be able to create an even better solution:
 

- In the DW backend go to "item types" -> "paragraph container" create a copy of the Item, and give it a suitable name.
- In the Files/Templates/Designs/Rapido/Pargraph folder copy the ParagraphContainer.cshtml file, and give it the exact same name as the new item type

Then open the new template and let’s customize:

My idea is that you, in the Model.Item.GetItems("Paragraph") loop, should try to catch the first four elements and place them in their own grid and then place the next elements in another grid:

In the top of the template, declare a new variable:

string paragraphCount = 0;

Wrap the loop in to a column element like this:


     <div class="@gridClasses">
          <div class="grid__col-6">
          @foreach (var paragraph in Model.Item.GetItems("Paragraph"))
 

Then locate the block that looks like this:

<div class="@columnCssClasses paragraph-container" style="@backgroundImage">

      @RenderContent(paragraph, Model.Item.GetBoolean("EnableCarousel"))

</div>

 

And rewrite it to be something like this:
 

<div class=”grid grid__bleed-x grid__bleed-y”
     <div class="@columnCssClasses paragraph-container" style="@backgroundImage">

           @RenderContent(paragraph)

     </div>
</div>

if (paragraphCount == 3) {

     paragraphCount = 0;
     string gridSplitter = “</div><div class=\”grid__col-6\”>”;
     @gridSplitter;

}
paragraphCount++;

Votes for this answer: 1
 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Hi Karsten, and thank you for providing a solution to our problem.
We can very well fix it like this, but we try to keep things as standard as possible, and would like to try to solve it without coding, using standard DW Rapido.

This is mainly as a feedback to you, so you know what kind of situations we get into. Hopefully it is possible to implement support for this scenario in future releases of Rapido.

 

You must be logged in to post in the forum