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

Fix misleading icon import documentation #5100

Merged
merged 4 commits into from
Jun 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions templates/docs/patterns/icons/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ context:

{% set social_icons = ['facebook', 'instagram', 'twitter', 'linkedin', 'youtube', 'github', 'rss', 'email'] %}

<!--
bartaz marked this conversation as resolved.
Show resolved Hide resolved
'chevron-up' and 'chevron-down' are class names, not mixin names; instead use 'chevron' for mixin import
TODO We should fix this icon-mixin naming discrepancy in the next major version.
See https://github.com/canonical/vanilla-framework/pull/5100
-->
bartaz marked this conversation as resolved.
Show resolved Hide resolved

{% set standard_icon_mixin_names = standard_icons | map('replace', 'chevron-down', 'chevron') | map('replace', 'chevron-up', 'chevron') | list %}

<!--
bartaz marked this conversation as resolved.
Show resolved Hide resolved
'information' is a class name, not a mixin name; instead use 'info' for mixin import
TODO We should fix this icon-mixin naming discrepancy in the next major version.
See https://github.com/canonical/vanilla-framework/pull/5100
-->
bartaz marked this conversation as resolved.
Show resolved Hide resolved

{% set status_icon_mixin_names = status_icons | map('replace', 'information', 'info') | list %}

<!--
bartaz marked this conversation as resolved.
Show resolved Hide resolved
Remove duplicates from the list of mixin names; otherwise there would be two 'chevron' entries
-->
bartaz marked this conversation as resolved.
Show resolved Hide resolved

{% set base_icon_mixin_names = (standard_icon_mixin_names + status_icon_mixin_names + social_icons) | unique %}

Icons provide visual context and enhance usability, they can be added via an `<i>` element like so: `<i class="p-icon--{name}"></i>`.

<div class="embedded-example"><a href="/docs/examples/patterns/icons/icons-light" class="js-example">
Expand Down Expand Up @@ -131,9 +153,8 @@ If you use a limited set of icons you may want to include them individually to r
@include vf-p-icons-common;

// include only the icons that you use in your project
{% for icon in standard_icons + status_icons + social_icons %}@include vf-p-icon-{{ icon }};
{% for mixin_name in base_icon_mixin_names %}@include vf-p-icon-{{ mixin_name }};
{% endfor %}

// additional icons
{% for icon in additional_icons %}@include vf-p-icon-{{ icon }};
{% endfor %}
Expand Down
Loading