refactor(docs-infra): grab scss mixins with scss use syntax instead of global imports (#41129)

move away from global mixins because @import is going to be deprecated

PR Close #41129
This commit is contained in:
AleksanderBodurri 2021-03-08 20:03:30 -05:00 committed by Andrew Kushnir
parent 21e35ece79
commit d429029074
39 changed files with 175 additions and 92 deletions

View File

@ -2,4 +2,4 @@
BASE STYLES BASE STYLES
============================== */ ============================== */
@import 'typography'; @forward 'typography';

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
html { html {
font-size: 62.5%; font-size: 62.5%;

View File

@ -2,11 +2,11 @@
LAYOUT STYLES LAYOUT STYLES
============================== */ ============================== */
@import 'content-layout/content-layout'; @forward 'content-layout/content-layout';
@import 'doc-viewer/doc-viewer'; @forward 'doc-viewer/doc-viewer';
@import 'footer/footer'; @forward 'footer/footer';
@import 'layout-global'; @forward 'layout-global';
@import 'marketing-layout/marketing-layout'; @forward 'marketing-layout/marketing-layout';
@import 'not-found'; @forward 'not-found';
@import 'sidenav'; @forward 'sidenav';
@import 'top-menu'; @forward 'top-menu';

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.nf-container { .nf-container {
align-items: center; align-items: center;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
// Disable sidenav animations for the initial render. // Disable sidenav animations for the initial render.
.starting.mat-drawer-transition .mat-drawer-content { .starting.mat-drawer-transition .mat-drawer-content {

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
// VARIABLES // VARIABLES
$showTopMenuWidth: 1048px; $showTopMenuWidth: 1048px;

View File

@ -1,3 +1,5 @@
@use '../../mixins' as *;
.sidenav-container { .sidenav-container {
width: 100%; width: 100%;
height: 100vh; height: 100vh;

View File

@ -0,0 +1,26 @@
@use '../../constants' as *;
@mixin footer-theme($theme) {
$primary: map-get($theme, primary);
$background: map-get($theme, background);
$foreground: map-get($theme, foreground);
$is-dark-theme: map-get($theme, is-dark);
footer {
background-color: $blue;
aio-footer {
& > * {
color: $white;
}
a {
color: $white;
}
h3 {
color: $white;
}
}
}
}

View File

@ -1,10 +1,12 @@
@use '../../constants';
@use '../../mixins' as *;
footer { footer {
position: relative; position: relative;
@include line-height(24); @include line-height(24);
flex: 1; flex: 1;
padding: 48px; padding: 48px;
z-index: 0; z-index: 0;
background-color: $blue;
font-weight: 300; font-weight: 300;
aio-footer { aio-footer {
@ -12,7 +14,6 @@ footer {
z-index: 0; z-index: 0;
& > * { & > * {
color: $white;
max-width: 50em; max-width: 50em;
} }
@ -22,7 +23,6 @@ footer {
} }
a { a {
color: $white;
text-decoration: none; text-decoration: none;
z-index: 20; z-index: 20;
position: relative; position: relative;
@ -37,7 +37,7 @@ footer {
&:focus { &:focus {
// `outline-offset` is not applied on Chrome on Windows, if `outline-style` is `auto. // `outline-offset` is not applied on Chrome on Windows, if `outline-style` is `auto.
outline: 1px solid rgba($white, 0.8); outline: 1px solid rgba(constants.$white, 0.8);
outline-offset: 2px; outline-offset: 2px;
} }
} }
@ -47,7 +47,6 @@ footer {
text-transform: uppercase; text-transform: uppercase;
font-weight: 400; font-weight: 400;
margin: 8px 0 12px; margin: 8px 0 12px;
color: $white;
@media (max-width: 600px) { @media (max-width: 600px) {
@include font-size(14); @include font-size(14);

View File

@ -1,13 +1,69 @@
@mixin marketing-layout-theme($theme) { @use '../../constants' as *;
$primary: map-get($theme, primary);
$background: map-get($theme, background);
$foreground: map-get($theme, foreground);
$is-dark-theme: map-get($theme, is-dark);
.background-sky { @mixin marketing-layout-theme($theme) {
background-color: mat-color($primary, default); $primary: map-get($theme, primary);
background: linear-gradient(145deg, mat-color($primary, 900), mat-color($primary, 400)); $background: map-get($theme, background);
color: mat-color($foreground, text); $foreground: map-get($theme, foreground);
$is-dark-theme: map-get($theme, is-dark);
.background-sky {
background-color: mat-color($primary, default);
background: linear-gradient(145deg, mat-color($primary, 900), mat-color($primary, 400));
color: mat-color($foreground, text);
}
section#intro {
color: $white;
}
.announcement-bar {
background-color: $white;
.button {
color: $white;
background-color: $blue;
&:hover {
color: rgba($white, 0.7);
} }
}
}
.home-row .card {
.card-text-container {
p {
color: if($is-dark-theme, $offwhite, $darkgray);
}
}
&:hover {
h2 {
color: $blue;
}
}
}
.button.hero-cta {
background-color: if($is-dark-theme, $darkgray, $white);
}
.cta-bar {
.hero-cta {
color: if($is-dark-theme, lighten($blue, 10), $blue);
}
}
.text-headline {
color: if($is-dark-theme, lighten($blue, 10), $blue);
}
.marketing-banner {
background-color: if($is-dark-theme, $blue, lighten($blue, 10));
.banner-headline {
color: $white;
}
}
} }

View File

@ -1,3 +1,6 @@
@use '../../constants' as *;
@use '../../mixins' as *;
.hero { .hero {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -42,7 +45,6 @@ section#intro {
height: 480px; height: 480px;
margin: 0 auto -32px; margin: 0 auto -32px;
padding: 48px 0 0; padding: 48px 0 0;
color: $white;
@media (max-width: 780px) { @media (max-width: 780px) {
flex-direction: column; flex-direction: column;
@ -108,7 +110,6 @@ section#intro {
margin-bottom: 8px; margin-bottom: 8px;
max-width: none; max-width: none;
padding: 0; padding: 0;
filter: drop-shadow(0 2px 2px rgba($black, 0.24));
@media (max-width: 780px) { @media (max-width: 780px) {
width: 250px; width: 250px;
@ -127,7 +128,6 @@ section#intro {
max-width: 50vw; max-width: 50vw;
margin: 0 auto; margin: 0 auto;
padding: 16px; padding: 16px;
background-color: $white;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 2px 2px rgba($black, 0.24), 0 0 2px rgba($black, 0.12); box-shadow: 0 2px 2px rgba($black, 0.24), 0 0 2px rgba($black, 0.12);
box-sizing: border-box; box-sizing: border-box;
@ -155,16 +155,10 @@ section#intro {
height: 40px; height: 40px;
min-width: 160px; min-width: 160px;
@include font-size(16); @include font-size(16);
color: $white;
background-color: $blue;
border-radius: 48px; border-radius: 48px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.26); box-shadow: 0 2px 5px 0 rgba(0,0,0,.26);
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
&:hover {
color: rgba($white, 0.7);
}
} }
.material-icons { .material-icons {
@ -226,18 +220,10 @@ section#intro {
p { p {
text-align: left; text-align: left;
color: $darkgray;
margin: 0; margin: 0;
padding: 8px 0; padding: 8px 0;
} }
} }
&:hover {
h2 {
color: $blue;
}
}
} }
.button.hero-cta { .button.hero-cta {
@ -245,7 +231,6 @@ section#intro {
@include font-size(18); @include font-size(18);
font-weight: 600; font-weight: 600;
@include line-height(40); @include line-height(40);
background-color: $white;
border-radius: 48px; border-radius: 48px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.26); box-shadow: 0 2px 5px 0 rgba(0,0,0,.26);
box-sizing: border-box; box-sizing: border-box;
@ -281,16 +266,11 @@ section#intro {
background: none; background: none;
box-shadow: none; box-shadow: none;
} }
.hero-cta {
color: $blue;
}
} }
.text-headline { .text-headline {
@include font-size(20); @include font-size(20);
font-weight: 500; font-weight: 500;
color: $blue;
margin-top: 10px; margin-top: 10px;
text-transform: uppercase; text-transform: uppercase;
} }
@ -365,7 +345,6 @@ div[layout=row]{
} }
.marketing-banner { .marketing-banner {
background-color: lighten($blue, 10);
margin-top: 64px; margin-top: 64px;
padding: 32px; padding: 32px;
@ -378,7 +357,6 @@ div[layout=row]{
text-transform: uppercase; text-transform: uppercase;
@include font-size(24); @include font-size(24);
font-weight: 300; font-weight: 300;
color: $white;
margin: 0; margin: 0;
-webkit-margin-before: 0; -webkit-margin-before: 0;
-webkit-margin-after: 0; -webkit-margin-after: 0;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.alert { .alert {
padding: 16px; padding: 16px;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
/* API LIST STYLES */ /* API LIST STYLES */

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.api-body { .api-body {
max-width: 1200px; max-width: 1200px;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
/* API SYMBOLS */ /* API SYMBOLS */

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
/* Button Styles */ /* Button Styles */

View File

@ -1,4 +1,6 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
@use './alert';
.callout { .callout {
@extend .alert; @extend .alert;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.card-container { .card-container {
display: flex; display: flex;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
code-example, code-example,
code-tabs { code-tabs {

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
aio-contributor-list { aio-contributor-list {
.contributor-group { .contributor-group {

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
aio-shell.mode-archive { aio-shell.mode-archive {
@include deploy-theme($blue-grey-900, $blue-grey-400); @include deploy-theme($blue-grey-900, $blue-grey-400);

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
/* /*
* General styling to make detail/summary tags look a bit more material * General styling to make detail/summary tags look a bit more material

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.error-list { .error-list {
display: grid; display: grid;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
// FEATURES MARKETING PAGE SPECIFIC STYLES // FEATURES MARKETING PAGE SPECIFIC STYLES

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.filetree { .filetree {
background: $white; background: $white;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.reviewed { .reviewed {
color: lighten($darkgray, 10); color: lighten($darkgray, 10);

View File

@ -2,33 +2,32 @@
MODULE STYLES MODULE STYLES
============================== */ ============================== */
@import 'alert'; @forward 'alert';
@import 'api-list'; @forward 'api-list';
@import 'api-pages'; @forward 'api-pages';
@import 'api-symbols'; @forward 'api-symbols';
@import 'buttons'; @forward 'buttons';
@import 'callout'; @forward 'callout';
@import 'card'; @forward 'card';
@import 'cli-pages'; @forward 'cli-pages';
@import 'code'; @forward 'code';
@import 'contribute'; @forward 'contribute';
@import 'contributor'; @forward 'contributor';
@import 'deploy-theme'; @forward 'deploy-theme';
@import 'details'; @forward 'details';
@import 'errors'; @forward 'errors';
@import 'features'; @forward 'features';
@import 'filetree'; @forward 'filetree';
@import 'guides'; @forward 'guides';
@import 'heading-anchors'; @forward 'heading-anchors';
@import 'hr'; @forward 'hr';
@import 'images'; @forward 'images';
@import 'label'; @forward 'label';
@import 'notification'; @forward 'notification';
@import 'progress-bar'; @forward 'progress-bar';
@import 'presskit'; @forward 'presskit';
@import 'resources'; @forward 'resources';
@import 'roadmap'; @forward 'search-results';
@import 'search-results'; @forward 'select-menu';
@import 'select-menu'; @forward 'table';
@import 'table'; @forward 'toc';
@import 'toc';

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.api-header label { .api-header label {
border-radius: 4px; border-radius: 4px;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
$notificationHeight: 56px; $notificationHeight: 56px;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
.presskit-container { .presskit-container {
padding: 0 32px 32px 32px; padding: 0 32px 32px 32px;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
aio-resource-list { aio-resource-list {
.showcase { .showcase {

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
aio-search-results { aio-search-results {
z-index: 10; z-index: 10;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
/* SELECT MENU */ /* SELECT MENU */

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
table { table {
margin: 24px 0px; margin: 24px 0px;

View File

@ -1,4 +1,5 @@
@use '../constants' as *; @use '../constants' as *;
@use '../mixins' as *;
$tocItemLineHeight: 24; $tocItemLineHeight: 24;
$tocItemTopPadding: 9; $tocItemTopPadding: 9;

View File

@ -1,5 +1,4 @@
@import '~@angular/material/theming'; @import '~@angular/material/theming';
@import '1-layouts/marketing-layout/marketing-layout-theme'; @import '1-layouts/marketing-layout/marketing-layout-theme';
@mixin app-theme($theme) { @mixin app-theme($theme) {

View File

@ -1,4 +1,4 @@
@use './constants'; @use './constants' as *;
// REM Font Adjustments // REM Font Adjustments
@mixin font-size($sizeValue) { @mixin font-size($sizeValue) {
@ -48,14 +48,14 @@
@mixin card($height, $width) { @mixin card($height, $width) {
height: $height; height: $height;
width: $width; width: $width;
background-color: constants.$white; background-color: $white;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 2px 2px rgba(constants.$black, 0.24), 0 0 2px rgba(constants.$black, 0.12); box-shadow: 0 2px 2px rgba($black, 0.24), 0 0 2px rgba($black, 0.12);
box-sizing: border-box; box-sizing: border-box;
transition: box-shadow .5s; transition: box-shadow .5s;
&:hover { &:hover {
box-shadow: 0 8px 8px rgba(constants.$black, 0.24), 0 0 8px rgba(constants.$black, 0.12); box-shadow: 0 8px 8px rgba($black, 0.24), 0 0 8px rgba($black, 0.12);
text-decoration: none; text-decoration: none;
} }
} }

View File

@ -1,13 +1,9 @@
// import global themes @use './ng-io-theme.scss';
@use './ng-io-theme';
// import global mixins
@import './mixins';
// import directories // import directories
@import './0-base'; @use './0-base' as base;
@import './1-layouts'; @use './1-layouts' as layouts;
@import './2-modules'; @use './2-modules' as modules;
// import print styles // import print styles
@import './print'; @import './print';