Start on dynamic square layout

This commit is contained in:
Christian Kremitzl 2019-04-25 22:48:53 +02:00
parent 3d6cbbbda2
commit 9a0fdc202a
3 changed files with 157 additions and 18 deletions

View File

@ -1,4 +1,67 @@
/* basic layout */
@import url("https://free.bboxtype.com/embedfonts/?family=FiraSans:300,600"); @import url("https://free.bboxtype.com/embedfonts/?family=FiraSans:300,600");
body {
background: red;
font-size: 1vw;
/* transition: background 1s ease; */ }
body .layout-content-and-preview {
display: grid;
grid-template-rows: 100vw auto;
grid-template-columns: auto;
grid-template-areas: "content" "preview";
min-height: 100vh;
max-height: 100vh;
min-width: 100vw;
max-width: 100vw;
overflow: auto; }
body .layout-content-and-preview .layout-content {
background: white;
grid-area: content; }
body .layout-content-and-preview .layout-preview {
grid-area: preview;
display: flex;
align-items: center;
justify-content: center;
/* padding: 4vw; */ }
body .layout-content-and-preview .layout-preview img {
opacity: .5;
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
box-shadow: 0.2em 0.2em 0.5em 0 rgba(0, 0, 0, 0.3); }
/*
@media screen and (min-aspect-ratio: 1/2) {
$base-unit: 0.5vh;
body {
background: orange;
.layout-content-and-preview {
grid-template-rows: 50vh auto;
grid-template-columns: auto 50vh auto;
grid-template-areas:
" . content . "
"preview preview preview";
}
}
}
*/
@media screen and (min-aspect-ratio: 1 / 1) {
body {
background: yellow; }
body .layout-content-and-preview {
grid-template-rows: auto 50vw auto;
grid-template-columns: 50vw auto;
grid-template-areas: " . preview" "content preview" " . preview"; } }
@media screen and (min-aspect-ratio: 2 / 1) {
body {
background: lime; }
body .layout-content-and-preview {
grid-template-rows: 100vh;
grid-template-columns: 100vh auto;
grid-template-areas: "content preview"; } }
@font-face { @font-face {
font-family: 'Fira Code'; font-family: 'Fira Code';
src: url("../../lib/font/fira-code/FiraCode-Regular.otf"); src: url("../../lib/font/fira-code/FiraCode-Regular.otf");
@ -12,12 +75,7 @@
body { body {
font-family: 'Fira Sans'; font-family: 'Fira Sans';
margin: 0; margin: 0;
line-height: 1.2em; line-height: 1.2em; }
font-size: 1.7vw; }
@media screen and (screen-orientation: landscape) {
body {
font-size: 3.5vh; } }
section { section {
min-height: 100vh; min-height: 100vh;

View File

@ -1,7 +1,89 @@
// @import "../template/mixins"; /* basic layout */
// @import "../template/settings";
// $heading2Size: 101px; $base-unit: 1vw;
// @import "../template/theme"; body {
background: red;
font-size: $base-unit;
/* transition: background 1s ease; */
.layout-content-and-preview {
display: grid;
grid-template-rows: 100vw auto;
grid-template-columns: auto;
grid-template-areas:
"content"
"preview";
min-height: 100vh;
max-height: 100vh;
min-width: 100vw;
max-width: 100vw;
overflow: auto;
.layout-content {
background: white;
grid-area: content;
}
.layout-preview {
grid-area: preview;
display: flex;
align-items: center;
justify-content: center;
/* padding: 4vw; */
img {
opacity: .5;
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
box-shadow: .2em .2em .5em 0 rgba(0, 0, 0, .3);
}
}
}
}
/*
@media screen and (min-aspect-ratio: 1/2) {
$base-unit: 0.5vh;
body {
background: orange;
.layout-content-and-preview {
grid-template-rows: 50vh auto;
grid-template-columns: auto 50vh auto;
grid-template-areas:
" . content . "
"preview preview preview";
}
}
}
*/
@media screen and (min-aspect-ratio: 1/1) {
$base-unit: 0.5vw;
body {
background: yellow;
.layout-content-and-preview {
grid-template-rows: auto 50vw auto;
grid-template-columns: 50vw auto;
grid-template-areas:
" . preview"
"content preview"
" . preview";
}
}
}
@media screen and (min-aspect-ratio: 2/1) {
$base-unit: 1vh;
body {
background: lime;
.layout-content-and-preview {
grid-template-rows: 100vh;
grid-template-columns: 100vh auto;
grid-template-areas:
"content preview";
}
}
}
@import url('https://free.bboxtype.com/embedfonts/?family=FiraSans:300,600'); @import url('https://free.bboxtype.com/embedfonts/?family=FiraSans:300,600');
@font-face { @font-face {
@ -20,12 +102,12 @@ body {
font-family: 'Fira Sans'; font-family: 'Fira Sans';
margin: 0; margin: 0;
line-height: 1.2em; line-height: 1.2em;
font-size: 1.7vw; // font-size: 1.7vw;
} }
@media screen and (screen-orientation: landscape) { @media screen and (screen-orientation: landscape) {
body { body {
font-size: 3.5vh; // font-size: 3.5vh;
} }
} }

View File

@ -12,12 +12,11 @@ Ein größeres LaTeX-Projekt anlegen und dabei ...
--- ---
<div class="layout layout-side-by-side"> <div class="layout layout-content-and-preview">
<div class="layout-content">
<h2 class="layout-title">Hauptdatei 👑</h2> <h2 class="layout-title">Hauptdatei 👑</h2>
<div class="layout-content-left">
<ul> <ul>
<li>enthält Grundgerüst, Titelei, etc. </li> <li>enthält Grundgerüst, Titelei, etc. </li>
<li>bindet einzelne Kapitel ein mit <li>bindet einzelne Kapitel ein mit
@ -42,7 +41,7 @@ Ein größeres LaTeX-Projekt anlegen und dabei ...
</div> </div>
<div class="layout-content-right"> <div class="layout-preview">
![](sections/german/04/projekt_dokument.png) ![](sections/german/04/projekt_dokument.png)
</div> </div>