website/static/src/scss/_blocks.scss

139 lines
2.3 KiB
SCSS

@mixin center-block($width: 85%, $mobile-width: 90%) {
width: $width;
margin: 0 auto;
max-width: $width;
min-width: $width;
@include touch {
max-width: $mobile-width;
min-width: $mobile-width;
width: $mobile-width;
}
}
div.block-mermaid {
text-align: center;
img {
@include dark-mode {
filter: invert(100%);
}
}
}
div.block-image,
div.block-mermaid,
div.block-iframe {
figcaption {
font-size: 85%;
margin-top: 5px;
}
figure {
@include center-block;
img {
width: auto;
height: auto;
max-height: 45vh;
}
}
}
div.block-iframe figure {
@include center-block(95%, 99%);
}
.content > div[class^="block-"] {
&:not(:last-child) {
margin-bottom: $content-block-margin-bottom;
}
}
div.block-embed {
lite-youtube {
@include center-block(75%);
// Add video title to top of player
&::before {
content: attr(playlabel);
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
color: $white;
padding-top: 15px;
padding-left: 15px;
padding-bottom: 65px; // 50px + padding-top
text-shadow: 0 0 2px color.adjust($black, $alpha: -0.5); // Stolen from YouTube player
font-size: 95%;
}
}
}
div.block-tangent {
.inner {
margin: math.div($content-block-margin-bottom, 4) 0;
padding-left: 1.5rem;
}
}
div.block-code {
position: relative;
.highlight {
pre,
span,
& {
@include dark-mode;
}
}
.code-header {
position: absolute;
font-family: $family-code;
width: 100%;
display: flex;
padding-right: 0.5rem;
.tag {
border-radius: 0 !important;
cursor: default;
}
.code-copy-tag {
background-color: transparent;
color: $dark;
@include dark-mode {
color: $dark-mode-text;
}
}
.language-tag {
background-color: $primary-light;
font-weight: $weight-medium;
@include dark-mode {
background-color: $primary-dark;
color: $white;
}
&.linguist-color span {
// HACK: Naive inverse threshold of the colour for optimum contrast
filter: contrast(1000) grayscale(100) invert(1);
}
}
}
}
div.block-table {
td,
th {
vertical-align: middle;
@include dark-mode {
color: $dark-mode-text;
}
}
}