From 3e873b3a8af4ef3ae9d3e41adf10bf3659cd0b3f Mon Sep 17 00:00:00 2001 From: ebremner <ebremner@uwaterloo.ca> Date: Tue, 15 Jun 2021 11:38:31 -0400 Subject: [PATCH] ISTWCMS-4704: updating tabs to now have a just buttons option and to all for button specific classes --- source/_patterns/04-components/tabs/_tabs.twig | 10 +++++++++- .../tabs/tabs--buttons/tabs--buttons.twig | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 source/_patterns/04-components/tabs/tabs--buttons/tabs--buttons.twig diff --git a/source/_patterns/04-components/tabs/_tabs.twig b/source/_patterns/04-components/tabs/_tabs.twig index 4bcc63fb..51f03d34 100644 --- a/source/_patterns/04-components/tabs/_tabs.twig +++ b/source/_patterns/04-components/tabs/_tabs.twig @@ -4,8 +4,16 @@ {% for type in content_list %} {% if tab_type == "link" %} <a href="{{ type.url }}" class="uw-tablinks {{ button_modifier_classes }}{% if type.active %} active{% endif %}">{{ type.text }}</a> + {% elseif tab_type == "button" %} + {% set button_class -%} + uw-tablinks {{ button_modifier_classes }}{% if type.button_class %} {{ type.button_class }}{% endif %} + {%- endset %} + <button class="{{ button_class }}">{{ type.text }}</button> {% else %} - <button role="tab" class="uw-tablinks {{ button_modifier_classes }}" {% if loop.index == 1 %} aria-selected="true" {% else %} aria-selected="false" {% endif %} aria-controls="{{ type }}" id="tab-{{ loop.index }}" tabindex="0">{{ type }}</button> + {% set button_class -%} + uw-tablinks {{ button_modifier_classes }}{% if type.button_class %} {{ type.button_class }}{% endif %} + {%- endset %} + <button role="tab" class="{{ button_class }}" {% if loop.index == 1 %} aria-selected="true" {% else %} aria-selected="false" {% endif %} aria-controls="{{ type }}" id="tab-{{ loop.index }}" tabindex="0">{{ type }}</button> {% endif %} {% endfor %} </div> diff --git a/source/_patterns/04-components/tabs/tabs--buttons/tabs--buttons.twig b/source/_patterns/04-components/tabs/tabs--buttons/tabs--buttons.twig new file mode 100644 index 00000000..de42eb8b --- /dev/null +++ b/source/_patterns/04-components/tabs/tabs--buttons/tabs--buttons.twig @@ -0,0 +1,10 @@ +{% set button_modifier_classes -%} + button button--large {{ modifier_classes }} +{%- endset %} + +{% include "@components/tabs/_tabs.twig" with { + tab_type: 'button', + content_list: content_list, + button_modifier_classes: button_modifier_classes, + tabs_modifier_class: tabs_modifier_class, +} %} \ No newline at end of file -- GitLab