Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 136 additions & 82 deletions styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,24 @@ html {
}

$img-margin: 8px;
$aside-width: 260px;
$prose-width: 940px;
$gap: 32px;
$max-size: 140;

:root {
--aside-width: 260px;
--prose-width: 940px;
--gap: 32px;
Comment thread
janezd marked this conversation as resolved.

@media (max-width: 680px) {
--aside-width: 0;
--prose-width: 100vw; // Using 100% allows some elements to expand
--gap: 0;
}
}

$aside-width: var(--aside-width);
$prose-width: var(--prose-width);
$gap: var(--gap);
Comment thread
janezd marked this conversation as resolved.

/*
* Commands that are used in MD
*/
Expand All @@ -44,7 +57,7 @@ $max-size: 140;
.full-width {
width: calc(100% + $aside-width + $gap);
max-width: calc(100% + $aside-width + $gap);
margin-left: (-$aside-width - $gap) !important;
margin-left: calc(-1 * $aside-width - $gap) !important;
}

[data-retina] + p img,
Expand All @@ -66,102 +79,138 @@ $max-size: 140;
}
}

[data-float-aside] + p, [data-float-aside] + div, div.float-aside, div.expanding-side-img {
margin: 0 !important;
position: absolute;
width: $aside-width;
font-weight: 400 !important;
transform: translateX(calc(-100% - $gap));

img {
margin-top: 8px !important;
margin-bottom: 8px !important;
}

.widget-iframe {
width: $aside-width !important;
}

p {
@media ( min-width: 681px ) {
[data-float-aside] + p, [data-float-aside] + div, div.float-aside, div.expanding-side-img {
margin: 0 !important;
position: absolute;
width: $aside-width;
font-weight: 400 !important;
}
}
transform: translateX(calc(-100% - $gap));

.mx-l320 {
margin-left: clamp(
calc($aside-width + 60px), /* minimum margin */
calc((100vw - $prose-width - $gap) / 2),/* preferred (centered) */
calc((100vw - $prose-width - $gap) / 2) /* max = same as preferred */
) !important;
margin-right: auto;
}

div.expanding-side-img {
transform-origin: top left;
position: relative;
animation: toAbsolute 0.5s forwards;
max-width: $aside-width;
padding: 0;
object-fit: contain;

@keyframes toAbsolute {
0% { position: relative; }
100% { position: absolute; }
}
img {
margin-top: 8px !important;
margin-bottom: 8px !important;
}

img {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.widget-iframe {
width: $aside-width !important;
}

img.retina {
zoom: 0.5;
p {
font-weight: 400 !important;
}
}

.children {
display: -webkit-box;
-webkit-line-clamp: 2; // number of lines
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
.mx-l320 {
margin-left: clamp(
calc($aside-width + 60px), /* minimum margin */
calc((100vw - $prose-width - $gap) / 2),/* preferred (centered) */
calc((100vw - $prose-width - $gap) / 2) /* max = same as preferred */
) !important;
margin-right: auto;
}

&:hover {
position: relative;
width: $prose-width;
max-width: min($prose-width, calc(100vw - 4rem));
div.expanding-side-img {
transform-origin: top left;
animation: none;
transition:
width 0.5s,
max-width 0.5s;
z-index: 100;
transform: translateX(calc(0px - $aside-width - $gap));
background-color: #eee;
border-radius: 4px;
position: relative;
animation: toAbsolute 0.5s forwards;
max-width: $aside-width;
padding: 0;
object-fit: contain;

img {
max-width: $prose-width;
transition: all 0.5s;
@keyframes toAbsolute {
0% { position: relative; }
100% { position: absolute; }
}

.caption.no-children, .children {
padding: 16px;
img {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}

.caption.with-children {
padding: 16px 16px 0 16px;
font-weight: 800 !important;
img.retina {
zoom: 0.5;
}

.children {
-webkit-line-clamp: unset;
overflow: visible;
text-overflow: unset;
display: block; // or whatever layout you need
display: -webkit-box;
-webkit-line-clamp: 2; // number of lines
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}

&:hover {
position: relative;
width: $prose-width;
max-width: min($prose-width, calc(100vw - 4rem));
transform-origin: top left;
animation: none;
transition:
width 0.5s,
max-width 0.5s;
z-index: 100;
transform: translateX(calc(0px - $aside-width - $gap));
background-color: #eee;
border-radius: 4px;

img {
max-width: $prose-width;
transition: all 0.5s;
}

.caption.no-children, .children {
padding: 16px;
}

.caption.with-children {
padding: 16px 16px 0 16px;
font-weight: 800 !important;
}

.children {
-webkit-line-clamp: unset;
overflow: visible;
text-overflow: unset;
display: block; // or whatever layout you need
}
}
}
}

@media ( max-width: 680px ) {
img, div.expanding-side-img {
max-width: $prose-width;
height: auto;
overflow: clip;
}

img:has(+ .caption) {
margin-bottom: 12px;
}

.expanding-side-img:has(.caption) {
margin-bottom: 42px;
}

.caption.no-children, .caption.with-children, .children {
font-weight: 400 !important;
font-style: italic;
}

.expressive-code {
max-width: $prose-width !important;
width: $prose-width !important;
overflow-x: auto;
}

.expressive-code, .expressive-code pre > code {
max-width: calc($prose-width - 30px) !important;
width: calc($prose-width - 30px) !important;
overflow-x: auto;
}
}

/*
* Layout
*/
Expand All @@ -170,12 +219,12 @@ div.expanding-side-img {

.aside {
width: $aside-width;
margin-right: 32px;
margin-right: $gap;
}

.right-column {
margin-left: auto;
width: calc(100% - $aside-width - 32px);
width: calc(100% - $aside-width - $gap);
}
}

Expand Down Expand Up @@ -349,6 +398,11 @@ h3 {
}
}

@media ( max-width: 680px ) {
.container {
padding: 0 8px;
}
}
///////
// Nav
///////
Expand Down
Loading