<a class="bux-link bux-link--alt" href="#" rel="noopener">
<span class="bux-link__text bux-link__text--underline">Inline link when text is on a light background</span>
</a>
{#
Link
Available variables:
- modifier: Sets the link variant. Allowed values: null, alt, reverse,
scarlet, before, after
- base_class: The base class for the component. Defaults to 'bux-link'.
- link_url: URL for the link.
- link_text: String for the link text.
- attributes: Additional attributes as an array of key-value pairs.
- isExternal: Boolean. If true, forces target="_blank" and adds rel="noopener".
- show_underline: Boolean. If true, shows the border-bottom underline.
#}
{# Get provided target and rel attributes #}
{% set provided_target = attributes.target|default(null) %}
{% set provided_rel = attributes.rel|default(null) %}
{# Update target if link is external #}
{% set final_target = provided_target %}
{% if isExternal %}
{% set final_target = '_blank' %}
{% endif %}
{# Override target for 'mailto:' and 'tel:' schemes #}
{% if link_url starts with 'mailto:' or link_url starts with 'tel:' %}
{% set final_target = null %}
{% endif %}
{# Append 'noopener' to rel attribute if 'opener' isn't specified #}
{% set final_rel = provided_rel %}
{% if 'opener' not in provided_rel %}
{% set final_rel = provided_rel ? (provided_rel ~ ' noopener')|trim : 'noopener' %}
{% endif %}
{# Prepare the base and text classes #}
{% set base_class = base_class|default('bux-link') %}
{% set base_classes = base_class|split(' ') %}
{% set text_classes = [] %}
{% for class in base_classes %}
{% set text_classes = text_classes|merge([class ~ '__text']) %}
{% endfor %}
{% set text_classes = text_classes|join(' ') %}
{% set show_underline = show_underline|default(true) %}
<a class="{{ base_class }}{% if modifier %} {{ base_class }}--{{ modifier }}{% endif %}"
{% if link_url %}
href="{{ link_url }}"
{% endif %}
{% if final_target %}
target="{{ final_target }}"
{% endif %}
{% if final_rel %}
rel="{{ final_rel }}"
{% endif %}
{% for attr_name, attr_value in attributes %}
{% if attr_name not in ['target', 'rel'] and attr_value %}
{% if attr_value is same as(true) %}
{{ attr_name }}
{% else %}
{{ attr_name }}="{{ attr_value }}"
{% endif %}
{% endif %}
{% endfor %}
>
{% block content %}
{% if link_text %}
<span class="{{ text_classes }}{% if show_underline %} bux-link__text--underline{% endif %}">{{ link_text }}</span>
{% endif %}
{% endblock %}
</a>
site_name_prefix: Office of
site_name: Learning Relations Excellence
site_slogan: Additional text or site slogan
address_1: 100 Building Name
address_2: 1 Oval Mall
city: Columbus
state: OH
zip: '43210'
contact_email: email@osu.edu
contact_phone: 614-292-OHIO
contact_tty: 614-688-8605
link_text: Inline link when text is on a light background
link_url: '#'
attributes: null
modifier: alt
%bux-link {
.bux-link__text--underline {
border-bottom: 1px solid;
}
&.bux-link--before {
.bux-link__text {
margin-left: 20px;
}
&:before {
position: absolute;
content: "\f015";
font-size: 1rem;
font-family: $icon;
padding-right: $sp-4;
}
}
&.bux-link--after {
&:after {
position: relative;
top: 2px;
content: "\f116";
font-size: 1rem;
font-family: $icon;
padding: 0 $sp-4;
}
}
}
@mixin create-bux-link($variant: null) {
@if $variant {
@include link-base($variant)
} @else {
@include link-base;
}
border-bottom: none;
@extend %bux-link;
}
.bux-link { @include create-bux-link(); }
.bux-link--reverse { @include create-bux-link(dark); }
.bux-link--alt { @include create-bux-link(light); }
.bux-link--scarlet { @include create-bux-link(scarlet); }
No notes defined.