Skip to content

Commit

Permalink
refactor(docs-infra): create external-link-with-icon mixin (#46482)
Browse files Browse the repository at this point in the history
create external-link-with-icon mixin in order to reduce scss code
duplication

PR Close #46482
  • Loading branch information
dario-piotrowicz authored and dylhunn committed Jun 24, 2022
1 parent 0c66032 commit f930fc2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
11 changes: 1 addition & 10 deletions aio/src/styles/0-base/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,7 @@ code {
> a {
&[href^="http:"],
&[href^="https:"] {
display: inline-flex;
padding-right: calc(1em + 0.25rem);
position: relative;

&::after {
content: "\e89e"; // codepoint for "open_in_new"
font-family: "Material Icons";
position: absolute;
right: 0;
}
@include mixins.external-link-with-icon();
}
}
}
Expand Down
9 changes: 1 addition & 8 deletions aio/src/styles/1-layouts/sidenav/_sidenav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,7 @@ aio-nav-menu {
&[href^="http:"],
&[href^="https:"] {
.vertical-menu-item-text {
display: inline-flex;
align-items: center;
&::after {
content: "\e89e"; // codepoint for "open_in_new"
margin-left: 0.3rem;
line-height: normal;
font-family: "Material Icons";
}
@include mixins.external-link-with-icon();
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions aio/src/styles/1-layouts/top-menu/_top-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,7 @@ mat-toolbar.app-toolbar {
&[href^="http:"],
&[href^="https:"] {
.nav-link-inner {
display: inline-flex;
align-items: center;
&::after {
content: "\e89e"; // codepoint for "open_in_new"
margin-left: 0.3rem;
font-family: "Material Icons";
}
@include mixins.external-link-with-icon();
}
}

Expand Down
15 changes: 15 additions & 0 deletions aio/src/styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,18 @@
}
}
}

@mixin external-link-with-icon() {
display: inline-flex;
align-items: center;

&::after {
content: "\e89e"; // codepoint for "open_in_new"
font-family: "Material Icons";
margin-left: 0.3rem;
// Note: float: right is used so that the icon doesn't inherit text underlines
float: right;
display: flex;
align-items: center;
}
}

0 comments on commit f930fc2

Please sign in to comment.