From d3ed8ccec65d340f01a3ea32f359dd0241fa2d20 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Mon, 24 Oct 2016 18:02:53 +0200 Subject: [PATCH] Added basic styles for @media print --- .eslintignore | 1 + .sass-lint.yml | 2 +- .../stylesheets/extensions/_permalinks.scss | 5 +++++ src/assets/stylesheets/layout/_base.scss | 21 +++++++++++++++---- src/assets/stylesheets/layout/_footer.scss | 5 +++++ src/assets/stylesheets/layout/_header.scss | 5 +++++ src/assets/stylesheets/layout/_sidebar.scss | 5 +++++ 7 files changed, 39 insertions(+), 5 deletions(-) diff --git a/.eslintignore b/.eslintignore index 61d9db52e..d80776538 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ /build /material /site +/lib diff --git a/.sass-lint.yml b/.sass-lint.yml index a302a49ab..4ae7787cd 100644 --- a/.sass-lint.yml +++ b/.sass-lint.yml @@ -102,7 +102,7 @@ rules: - order: smacss property-units: - 2 - - global: [rem, em, s, vh] + - global: [rem, em, s, vh, mm] pseudo-element: 2 quotes: - 2 diff --git a/src/assets/stylesheets/extensions/_permalinks.scss b/src/assets/stylesheets/extensions/_permalinks.scss index d2aec1921..ff9606fc4 100644 --- a/src/assets/stylesheets/extensions/_permalinks.scss +++ b/src/assets/stylesheets/extensions/_permalinks.scss @@ -37,6 +37,11 @@ opacity 0.125s 0.25s; color: $md-color-black--lighter; opacity: 0; + + // Hide for print + @media print { + display: none; + } } // All headers with permalinks have ids diff --git a/src/assets/stylesheets/layout/_base.scss b/src/assets/stylesheets/layout/_base.scss index 2997a2d48..4ccd8fea8 100644 --- a/src/assets/stylesheets/layout/_base.scss +++ b/src/assets/stylesheets/layout/_base.scss @@ -46,10 +46,14 @@ body { position: relative; min-height: 100%; - // Lock body to viewport height (e.g. in search mode) - &[data-md-locked] { - height: 100%; - overflow: hidden; + // [tablet portrait -]: Lock body to disable scroll bubbling + @include break-to-device(tablet portrait) { + + // Lock body to viewport height (e.g. in search mode) + &[data-md-locked] { + height: 100%; + overflow: hidden; + } } } @@ -160,3 +164,12 @@ hr { overflow: hidden; } } + +// ---------------------------------------------------------------------------- +// Rules: print styles +// ---------------------------------------------------------------------------- + +// Add margins to page +@page { + margin: 25mm; +} diff --git a/src/assets/stylesheets/layout/_footer.scss b/src/assets/stylesheets/layout/_footer.scss index d47a46a60..a7afa2b71 100644 --- a/src/assets/stylesheets/layout/_footer.scss +++ b/src/assets/stylesheets/layout/_footer.scss @@ -30,6 +30,11 @@ bottom: 0; width: 100%; + // Hide for print + @media print { + display: none; + } + // Footer container &__inner { background: $md-color-black; diff --git a/src/assets/stylesheets/layout/_header.scss b/src/assets/stylesheets/layout/_header.scss index 3e9917873..3d0ad93a0 100644 --- a/src/assets/stylesheets/layout/_header.scss +++ b/src/assets/stylesheets/layout/_header.scss @@ -36,6 +36,11 @@ background: $md-color-primary; color: $md-color-white; z-index: 1; + + // Hide for print + @media print { + display: none; + } } // Navigation within header diff --git a/src/assets/stylesheets/layout/_sidebar.scss b/src/assets/stylesheets/layout/_sidebar.scss index f75ffad9e..ddfefea51 100644 --- a/src/assets/stylesheets/layout/_sidebar.scss +++ b/src/assets/stylesheets/layout/_sidebar.scss @@ -31,6 +31,11 @@ float: left; overflow: visible; + // Hide for print + @media print { + display: none; + } + // Lock sidebar to container height (account for fixed header) &[data-md-locked] { position: fixed;