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

[#341] Added disable and single icon flags to text-icon. #403

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
108 changes: 81 additions & 27 deletions components/00-base/menu/__snapshots__/menu.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ exports[`Menu Component renders collapsible menu 1`] = `
href="/"
title="Home"
>
Home


Home
</a>


Expand All @@ -60,7 +62,9 @@ exports[`Menu Component renders collapsible menu 1`] = `
href="/about"
title="About"
>
About


About
</a>


Expand Down Expand Up @@ -91,7 +95,9 @@ exports[`Menu Component renders collapsible menu 1`] = `
href="/services"
title="Services"
>
Services


Services
</a>


Expand Down Expand Up @@ -136,7 +142,9 @@ exports[`Menu Component renders collapsible menu 1`] = `
href="/services/consulting"
title="Consulting"
>
Consulting


Consulting
</a>


Expand All @@ -163,7 +171,9 @@ exports[`Menu Component renders collapsible menu 1`] = `
href="/services/development"
title="Development"
>
Development


Development
</a>


Expand Down Expand Up @@ -228,7 +238,9 @@ exports[`Menu Component renders menu items with additional attributes 1`] = `
href="/"
title="Home"
>
Home


Home
</a>


Expand Down Expand Up @@ -257,7 +269,9 @@ exports[`Menu Component renders menu items with additional attributes 1`] = `
href="/about"
title="About"
>
About


About
</a>


Expand Down Expand Up @@ -286,7 +300,9 @@ exports[`Menu Component renders menu items with additional attributes 1`] = `
href="/services"
title="Services"
>
Services


Services
</a>


Expand Down Expand Up @@ -322,7 +338,9 @@ exports[`Menu Component renders menu items with additional attributes 1`] = `
href="/services/consulting"
title="Consulting"
>
Consulting


Consulting
</a>


Expand Down Expand Up @@ -351,7 +369,9 @@ exports[`Menu Component renders menu items with additional attributes 1`] = `
href="/services/development"
title="Development"
>
Development


Development
</a>


Expand Down Expand Up @@ -415,7 +435,9 @@ exports[`Menu Component renders menu items with correct attributes 1`] = `
href="/"
title="Home"
>
Home


Home
</a>


Expand Down Expand Up @@ -443,7 +465,9 @@ exports[`Menu Component renders menu items with correct attributes 1`] = `
href="/about"
title="About"
>
About


About
</a>


Expand Down Expand Up @@ -471,7 +495,9 @@ exports[`Menu Component renders menu items with correct attributes 1`] = `
href="/services"
title="Services"
>
Services


Services
</a>


Expand Down Expand Up @@ -506,7 +532,9 @@ exports[`Menu Component renders menu items with correct attributes 1`] = `
href="/services/consulting"
title="Consulting"
>
Consulting


Consulting
</a>


Expand Down Expand Up @@ -534,7 +562,9 @@ exports[`Menu Component renders menu items with correct attributes 1`] = `
href="/services/development"
title="Development"
>
Development


Development
</a>


Expand Down Expand Up @@ -597,7 +627,9 @@ exports[`Menu Component renders with default values - submenu 1`] = `
href="/"
title="Home"
>
Home


Home
</a>


Expand All @@ -624,7 +656,9 @@ exports[`Menu Component renders with default values - submenu 1`] = `
href="/about"
title="About"
>
About


About
</a>


Expand All @@ -651,7 +685,9 @@ exports[`Menu Component renders with default values - submenu 1`] = `
href="/services"
title="Services"
>
Services


Services
</a>


Expand Down Expand Up @@ -685,7 +721,9 @@ exports[`Menu Component renders with default values - submenu 1`] = `
href="/services/consulting"
title="Consulting"
>
Consulting


Consulting
</a>


Expand All @@ -712,7 +750,9 @@ exports[`Menu Component renders with default values - submenu 1`] = `
href="/services/development"
title="Development"
>
Development


Development
</a>


Expand Down Expand Up @@ -775,7 +815,9 @@ exports[`Menu Component renders with default values 1`] = `
href="/"
title="Home"
>
Home


Home
</a>


Expand All @@ -802,7 +844,9 @@ exports[`Menu Component renders with default values 1`] = `
href="/about"
title="About"
>
About


About
</a>


Expand Down Expand Up @@ -853,7 +897,9 @@ exports[`Menu Component renders with theme and custom classes 1`] = `
href="/"
title="Home"
>
Home


Home
</a>


Expand All @@ -880,7 +926,9 @@ exports[`Menu Component renders with theme and custom classes 1`] = `
href="/about"
title="About"
>
About


About
</a>


Expand All @@ -907,7 +955,9 @@ exports[`Menu Component renders with theme and custom classes 1`] = `
href="/services"
title="Services"
>
Services


Services
</a>


Expand Down Expand Up @@ -941,7 +991,9 @@ exports[`Menu Component renders with theme and custom classes 1`] = `
href="/services/consulting"
title="Consulting"
>
Consulting


Consulting
</a>


Expand All @@ -968,7 +1020,9 @@ exports[`Menu Component renders with theme and custom classes 1`] = `
href="/services/development"
title="Development"
>
Development


Development
</a>


Expand Down
13 changes: 11 additions & 2 deletions components/00-base/text-icon/text-icon.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
* - icon: [string] Icon name.
* - icon_placement: [string] Icon position: before, after.
* - icon_class: [string] Class for custom icon.
* - icon_group_disabled: [boolean] Disable icon and last word grouping.
* - icon_single_only: [boolean] Only show 1 icon. If icon and is_external, external will take preference.
*/
#}

{% set icon = icon and is_external and icon_single_only ? 'upper-right-arrow' : icon %}

{% apply spaceless %}
{% set icon_placement = icon_placement in ['before', 'after'] ? icon_placement : 'after' %}

Expand Down Expand Up @@ -49,7 +54,7 @@
{% endif %}

{# Add external icon #}
{% if is_external %}
{% if is_external and not icon_single_only %}
{% set is_external_content %}
{%- include '@base/icon/icon.twig' with {
symbol: 'upper-right-arrow',
Expand All @@ -59,7 +64,11 @@
{% endif %}

{# Set the markup #}
{{- before_group|raw }} <span class="ct-text-icon__group">{{- within_group|raw -}}</span>
{% if icon_group_disabled %}
{{- before_group|raw }} {{ within_group|raw -}}
{% else %}
{{- before_group|raw }} <span class="ct-text-icon__group">{{- within_group|raw -}}</span>
{% endif %}
{% endif %}

{% else %}
Expand Down
19 changes: 14 additions & 5 deletions components/01-atoms/button/__snapshots__/button.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ exports[`Button Component renders as a link with optional attributes 1`] = `
role="button"
target="_blank"
>







Expand Down Expand Up @@ -66,7 +68,9 @@ exports[`Button Component renders as a link with optional attributes, is externa
role="button"
target="_blank"
>







Expand All @@ -78,6 +82,7 @@ exports[`Button Component renders as a link with optional attributes, is externa







Expand Down Expand Up @@ -130,7 +135,7 @@ exports[`Button Component renders as a link with optional attributes, is externa

</span>




<span
Expand Down Expand Up @@ -187,7 +192,9 @@ exports[`Button Component renders with disabled state 1`] = `
data-component-name="button"
disabled="disabled"
>
Click me


Click me
</button>


Expand All @@ -203,7 +210,9 @@ exports[`Button Component renders with required attributes 1`] = `
class="ct-button ct-theme-light ct-button--button ct-button--regular "
data-component-name="button"
>
Click me


Click me
</button>


Expand Down
Loading