Configurable layout breakpoints

This commit is contained in:
saberzero1 2024-08-14 16:12:01 +02:00
parent a94d2844ca
commit 44cb4a43e1
6 changed files with 46 additions and 30 deletions

View File

@ -62,7 +62,7 @@
height: 60vh; height: 60vh;
width: 50vw; width: 50vw;
@media all and (max-width: $desktopBreakpoint) { @media all and ($desktop) {
width: 90%; width: 90%;
} }
} }

View File

@ -13,7 +13,7 @@ li.section-li {
display: grid; display: grid;
grid-template-columns: fit-content(8em) 3fr 1fr; grid-template-columns: fit-content(8em) 3fr 1fr;
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
& > .tags { & > .tags {
display: none; display: none;
} }

View File

@ -70,7 +70,7 @@
opacity 0.3s ease, opacity 0.3s ease,
visibility 0.3s ease; visibility 0.3s ease;
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
display: none !important; display: none !important;
} }
} }

View File

@ -62,7 +62,7 @@
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
@media all and (max-width: $desktopBreakpoint) { @media all and ($desktop) {
width: 90%; width: 90%;
} }
@ -104,7 +104,7 @@
flex: 0 0 min(30%, 450px); flex: 0 0 min(30%, 450px);
} }
@media all and (min-width: $tabletBreakpoint) { @media all and not ($tablet) {
&[data-preview] { &[data-preview] {
& .result-card > p.preview { & .result-card > p.preview {
display: none; display: none;
@ -130,7 +130,7 @@
border-radius: 5px; border-radius: 5px;
} }
@media all and (max-width: $tabletBreakpoint) { @media all and ($tablet) {
& > #preview-container { & > #preview-container {
display: none !important; display: none !important;
} }

View File

@ -109,11 +109,11 @@ a {
.desktop-only { .desktop-only {
display: initial; display: initial;
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
display: none; display: none;
} }
&.toc { &.toc {
@media all and (max-width: $tabletBreakpoint) { @media all and ($tablet) {
display: none; display: none;
} }
} }
@ -121,21 +121,21 @@ a {
.mobile-only { .mobile-only {
display: none; display: none;
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
display: initial; display: initial;
} }
&.toc { &.toc {
@media all and (max-width: $tabletBreakpoint) { @media all and ($tablet) {
display: initial; display: initial;
} }
} }
} }
.page { .page {
@media all and (max-width: $desktopBreakpoint) { @media all and ($desktop) {
padding: 0 1rem; padding: 0 1rem;
} }
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
margin: 0 auto; margin: 0 auto;
max-width: 100%; max-width: 100%;
} }
@ -169,10 +169,10 @@ a {
& > #quartz-body { & > #quartz-body {
width: 100%; width: 100%;
display: flex; display: flex;
@media all and (max-width: $desktopBreakpoint) { @media all and ($desktop) {
flex-direction: column; flex-direction: column;
} }
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
padding: 0 1rem; padding: 0 1rem;
} }
@ -190,11 +190,11 @@ a {
} }
& .sidebar.left { & .sidebar.left {
left: 0;
@media all and (min-width: $desktopBreakpoint) {
left: calc(calc(100vw - $pageWidth) / 2 - $sidePanelWidth); left: calc(calc(100vw - $pageWidth) / 2 - $sidePanelWidth);
@media all and ($desktop) {
left: 0;
} }
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
gap: 0; gap: 0;
align-items: center; align-items: center;
position: initial; position: initial;
@ -208,11 +208,13 @@ a {
& .sidebar.right { & .sidebar.right {
right: calc(calc(100vw - $pageWidth) / 2 - $sidePanelWidth); right: calc(calc(100vw - $pageWidth) / 2 - $sidePanelWidth);
flex-wrap: wrap; flex-wrap: wrap;
@media all and (min-width: $mobileBreakpoint) {
margin-left: $sidePanelWidth; margin-left: $sidePanelWidth;
margin-right: 0; margin-right: 0;
@media all and ($mobile) {
margin-left: inherit;
margin-right: inherit;
} }
@media all and (max-width: $desktopBreakpoint) { @media all and ($desktop) {
position: initial; position: initial;
flex-direction: row; flex-direction: row;
padding: 0; padding: 0;
@ -232,17 +234,17 @@ a {
width: $pageWidth; width: $pageWidth;
margin-top: 1rem; margin-top: 1rem;
@media all and (max-width: $tabletBreakpoint) { @media all and ($tablet) {
width: initial; width: initial;
} }
} }
& .page-header { & .page-header {
margin: $topSpacing auto 0 auto; margin: $topSpacing auto 0 auto;
@media all and (max-width: $desktopBreakpoint) { @media all and ($desktop) {
margin: $topSpacing 0 0 0; margin: $topSpacing 0 0 0;
} }
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
margin-top: 2rem; margin-top: 2rem;
} }
} }
@ -252,13 +254,13 @@ a {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
width: $pageWidth; width: $pageWidth;
@media all and (max-width: $desktopBreakpoint) { @media all and ($desktop) {
width: calc(100% - $sidePanelWidth); width: calc(100% - $sidePanelWidth);
right: 0; right: 0;
margin-left: $sidePanelWidth; margin-left: $sidePanelWidth;
margin-right: 0; margin-right: 0;
} }
@media all and (max-width: $mobileBreakpoint) { @media all and ($mobile) {
width: initial; width: initial;
margin-left: 0; margin-left: 0;
} }

View File

@ -1,7 +1,21 @@
/**
* Layout breakpoints
* $mobile: screen width below this value will use mobile styles
* $tablet: screen width below this value will use tablet styles
* $desktop: screen width below this value will use desktop styles
* assuming mobile < tablet < desktop
*/
$breakpoints: (
mobile: 750px,
tablet: 1000px,
desktop: 1500px,
);
$mobile: "(max-width: #{map-get($breakpoints, mobile)})";
$tablet: "(max-width: #{map-get($breakpoints, tablet)})";
$desktop: "(max-width: #{map-get($breakpoints, desktop)})";
$pageWidth: 750px; $pageWidth: 750px;
$mobileBreakpoint: 750px;
$tabletBreakpoint: 1000px;
$desktopBreakpoint: 1500px;
$sidePanelWidth: 380px; $sidePanelWidth: 380px;
$topSpacing: 6rem; $topSpacing: 6rem;
$boldWeight: 700; $boldWeight: 700;