canonical / vanilla-framework

From community websites to web applications, this CSS framework will help you achieve a consistent look and feel.
https://vanillaframework.io
GNU Lesser General Public License v3.0
798 stars 163 forks source link

Percy examples combination - Jinja vertical spacing option #5176

Closed jmuzina closed 1 week ago

jmuzina commented 1 week ago

Some combined examples (such as search & filter, context menu, navigation) have overlay/non-contained contents that can overlap other combined examples if we're not careful.

In my PRs so far I have been handling this case manually by creating multple divs with u-sv3 after examples that need extra space below them. However, this came to be tedious so I have come up with a (hopefully) more streamlined approach for this.

This does the following:

Example

Example usage, with Search & Filter

Markup

{% extends "_layouts/examples.html" %}
{% block title %}Search and filter / Combined{% endblock %}

{% block standalone_css %}patterns_search-and-filter{% endblock %}

{% block content %}
{% with is_combined = true %}
<section>{% include 'docs/examples/patterns/search-and-filter/chip-overflow.html' %}</section>
<section>{% include 'docs/examples/patterns/search-and-filter/default.html' %}</section>
<section>{% include 'docs/examples/patterns/search-and-filter/expanded.html' %}</section>
<section>
  {% with spacing_below = 17 %}
    {% include 'docs/examples/patterns/search-and-filter/with-chips.html' %}
  {% endwith %}
</section>
<section>{% include 'docs/examples/patterns/search-and-filter/with-search-prompt.html' %}</section>
{% endwith %}
{% endblock %}

Screenshot

image

webteam-app commented 1 week ago

Demo

Jenkins

demos.haus

bartaz commented 1 week ago

Each individual example in the combined examples is wrapped in it's own <section> - would it be enough to set some min-height on this section wrapper (when we know it's needed)? Seems a bit less involved then generating dozens of spacer divs.

Or, if we really want to automate this, it would be better for the individual example itself to define how tall it needs to be, rather than combined example to define how much space to put.

jmuzina commented 1 week ago

@bartaz Revised to use rems for spacing, as discussed in our 1:1

jmuzina commented 1 week ago

Rolling this into #5174 for review simplicity.