Visitar URL original
Links: Use add-color-icon mixin with currentColor for external link by aduth · Pull Request #4297 · uswds/uswds · GitHub
Skip to content
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
1 change: 0 additions & 1 deletion src/img/usa-icons-bg/launch--blue-60v.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/img/usa-icons-bg/launch--blue-70v.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/img/usa-icons-bg/launch--gray-5.svg

This file was deleted.

25 changes: 12 additions & 13 deletions src/stylesheets/core/mixins/_external-link.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
@mixin external-link(
$external-link,
$external-link-hover,
$image-path: $theme-image-path
) {
$external-link-size: 1.75ex;

$icon-object: (
"name": "launch",
"color": currentColor,
"height": $external-link-size,
"svg-height": 24,
"svg-width": 24,
);

@mixin external-link($contrast-bg: "default") {
&::after {
$external-link-size: 1.75ex;
background-image: url("#{$image-path}/#{$external-link}.svg");
background-repeat: no-repeat;
background-size: 100%;
@include add-color-icon($icon-object, $contrast-bg);
content: "";
height: $external-link-size;
margin-left: units(2px);
Expand All @@ -17,8 +20,4 @@
padding-left: $external-link-size;
vertical-align: middle;
}

&:hover::after {
@include add-background-svg("#{$external-link-hover}", $image-path);
}
}
2 changes: 1 addition & 1 deletion src/stylesheets/core/mixins/_icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
// Mask supported styles
@supports (mask: url("")) {
background: none;
background-color: color($color);
background-color: if($color == currentColor, $color, color($color));
mask: $mask-props;
@if $color-hover {
&:hover {
Expand Down
10 changes: 2 additions & 8 deletions src/stylesheets/elements/typography/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@
// [href^='https:']:not([href*='my-domain.com'])

.usa-link--external {
@include external-link(
usa-icons-bg/launch--blue-60v,
usa-icons-bg/launch--blue-70v
);
@include external-link();

&.usa-link--alt {
@include external-link(
usa-icons-bg/launch--gray-5,
usa-icons-bg/launch--white
);
@include external-link($contrast-bg: "base-darker");
}
}