Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percy examples combination - Jinja vertical spacing option #5176

Conversation

jmuzina
Copy link
Member

@jmuzina jmuzina commented Jun 19, 2024

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:

  • Creates a new combined.scss that the examples template can import to load vertical spacing utility styling. This prevents having to create separate -combined.scss style files for combined examples that need to include the vertical spacing utility.
  • Allows passing spacing_below into an example template. If spacing_below is defined and the example is a combined example, then a div with margin-bottom: <spacing_below>rem will be added below the block content to make space for whatever content is needed.

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
Copy link

@bartaz
Copy link
Contributor

bartaz commented Jun 20, 2024

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.

@bartaz bartaz added the Question ❓ Further information is requested label Jun 20, 2024
@jmuzina
Copy link
Member Author

jmuzina commented Jun 20, 2024

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

@jmuzina jmuzina removed the Question ❓ Further information is requested label Jun 20, 2024
@jmuzina
Copy link
Member Author

jmuzina commented Jun 20, 2024

Rolling this into #5174 for review simplicity.

@jmuzina jmuzina closed this Jun 20, 2024
@jmuzina jmuzina deleted the examples-combination-spacing-option branch June 25, 2024 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants