2018-11-28 00:29:27 +01:00
|
|
|
@mixin between {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
|
|
|
|
2019-02-26 22:53:50 +01:00
|
|
|
@mixin breakpoint-max($breakpoint) {
|
|
|
|
@media (max-width: #{$breakpoint}px) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin breakpoint-min($breakpoint) {
|
|
|
|
@media (min-width: #{$breakpoint}px) {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-03 22:05:48 +01:00
|
|
|
@mixin center {
|
|
|
|
align-items: center;
|
|
|
|
display: inline-flex;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin clearfix {
|
|
|
|
clear: both;
|
|
|
|
content: "";
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
2018-11-28 00:29:27 +01:00
|
|
|
// (Smart) text truncation
|
|
|
|
// Pass in a width to customize how much text is allowed
|
|
|
|
// Omit value for basic text truncation
|
|
|
|
@mixin constrict($value: null) {
|
|
|
|
@if ($value) {
|
2018-11-29 00:36:23 +01:00
|
|
|
max-width: $value;
|
2018-11-28 00:29:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
|
2018-12-04 21:46:22 +01:00
|
|
|
@mixin create-grid($items-per-row: 4) {
|
|
|
|
grid-template: repeat(1, 1fr) / repeat($items-per-row, 1fr);
|
|
|
|
}
|
|
|
|
|
2018-12-03 23:47:48 +01:00
|
|
|
// Smart font include
|
|
|
|
// Simply pass in the font-weight you want to use and the normal/italicized versions will be added
|
|
|
|
// No more weighing down the front-end with references to unused weights
|
2018-12-11 20:13:52 +01:00
|
|
|
@mixin font-face($font-weight, $relative-font-path, $font-name) {
|
2018-12-03 23:47:48 +01:00
|
|
|
@font-face {
|
2018-12-11 20:13:52 +01:00
|
|
|
font-family: $font-name;
|
2018-12-03 23:47:48 +01:00
|
|
|
font-style: normal;
|
|
|
|
font-weight: $font-weight;
|
2018-12-04 00:02:21 +01:00
|
|
|
// sass-lint:disable indentation
|
2018-12-11 20:13:52 +01:00
|
|
|
src: url("#{$relative-font-path}/#{$font-weight}.woff2") format("woff2"),
|
|
|
|
url("#{$relative-font-path}/#{$font-weight}.woff") format("woff");
|
2018-12-04 00:02:21 +01:00
|
|
|
// sass-lint:enable indentation
|
2018-12-03 23:47:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@font-face {
|
2018-12-11 20:13:52 +01:00
|
|
|
font-family: $font-name;
|
2018-12-03 23:47:48 +01:00
|
|
|
font-style: italic;
|
|
|
|
font-weight: $font-weight;
|
2018-12-04 00:02:21 +01:00
|
|
|
// sass-lint:disable indentation
|
2018-12-11 20:13:52 +01:00
|
|
|
src: url("#{$relative-font-path}/#{$font-weight}i.woff2") format("woff2"),
|
|
|
|
url("#{$relative-font-path}/#{$font-weight}i.woff") format("woff");
|
2018-12-04 00:02:21 +01:00
|
|
|
// sass-lint:enable indentation
|
2018-12-03 23:47:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-03 22:10:53 +01:00
|
|
|
@mixin font-mono {
|
2019-02-06 01:03:03 +01:00
|
|
|
font-family: "Fira Code", "Courier New", monospace;
|
2018-12-03 22:10:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@mixin font-sans {
|
2019-02-06 01:03:03 +01:00
|
|
|
font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
2018-12-03 22:10:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@mixin font-serif {
|
|
|
|
font-family: Georgia, serif;
|
|
|
|
}
|
|
|
|
|
2018-12-03 22:05:48 +01:00
|
|
|
@mixin hide-text {
|
|
|
|
border: none;
|
|
|
|
color: transparent;
|
|
|
|
font: 0 / 0 a;
|
|
|
|
text-shadow: none;
|
|
|
|
}
|
|
|
|
|
2018-12-04 23:08:36 +01:00
|
|
|
// Cross-browser line-clamp support
|
|
|
|
@mixin line-clamp(
|
|
|
|
$element-height: 2rem,
|
|
|
|
$row-count: 2,
|
2019-03-11 16:41:27 +01:00
|
|
|
$fade-color: var(--lbry-white),
|
2018-12-04 23:08:36 +01:00
|
|
|
$computed-position: relative
|
|
|
|
) {
|
|
|
|
height: $element-height;
|
|
|
|
overflow: hidden;
|
|
|
|
position: $computed-position;
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
width: 50%; height: calc(#{$element-height} / #{$row-count});
|
|
|
|
right: 0; bottom: 0;
|
|
|
|
|
|
|
|
background-image: linear-gradient(to right, rgba($lbry-white, 0), #{$fade-color} 80%);
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-03 22:05:48 +01:00
|
|
|
@mixin no-user-select {
|
|
|
|
user-select: none;
|
|
|
|
|
|
|
|
-ms-user-select: none;
|
|
|
|
-moz-user-select: none;
|
|
|
|
-webkit-user-select: none;
|
|
|
|
}
|
|
|
|
|
2018-11-28 00:29:27 +01:00
|
|
|
// TODO: Make customizable
|
|
|
|
// The `background-position` in `loading-animation` is the same width as this `background-size`
|
|
|
|
// The same values can be passed to both
|
|
|
|
@mixin placeholder {
|
|
|
|
animation-duration: 4s;
|
|
|
|
animation-fill-mode: forwards;
|
|
|
|
animation-iteration-count: infinite;
|
|
|
|
animation-name: loading-animation;
|
|
|
|
animation-timing-function: linear;
|
|
|
|
background-color: transparent;
|
2019-03-11 16:41:27 +01:00
|
|
|
background-image: linear-gradient(to right, var(--lbry-gray-3) 10%, transparent 80%, var(--lbry-gray-3) 100%);
|
2018-11-28 00:29:27 +01:00
|
|
|
background-repeat: repeat;
|
|
|
|
background-size: 500px;
|
|
|
|
|
|
|
|
[data-mode="dark"] & {
|
|
|
|
background-image: linear-gradient(
|
|
|
|
to right,
|
|
|
|
rgba($lbry-white, 0.1) 10%,
|
|
|
|
transparent 80%,
|
|
|
|
rgba($lbry-white, 0.1) 100%
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-27 23:41:30 +01:00
|
|
|
// Use CSS variables without upsetting Sass-Lint
|
|
|
|
// https://github.com/sasstools/sass-lint/issues/1161#issuecomment-390537190
|
|
|
|
@mixin root-prop($prop: null, $value: null) {
|
|
|
|
@if ($prop and $value) {
|
|
|
|
#{$prop}: $value;
|
|
|
|
}
|
|
|
|
}
|
2018-11-28 00:29:27 +01:00
|
|
|
|
2019-03-11 16:41:27 +01:00
|
|
|
@mixin selection($background-color: var(--lbry-white), $text-color: var(--lbry-black)) {
|
2018-12-03 22:05:48 +01:00
|
|
|
&::selection {
|
|
|
|
background-color: $background-color;
|
|
|
|
color: $text-color;
|
|
|
|
text-shadow: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&::-moz-selection {
|
|
|
|
background-color: $background-color;
|
|
|
|
color: $text-color;
|
|
|
|
text-shadow: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-28 00:29:27 +01:00
|
|
|
@mixin thumbnail {
|
|
|
|
&::before,
|
|
|
|
&::after {
|
|
|
|
content: "";
|
|
|
|
}
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
float: left;
|
|
|
|
padding-top: var(--aspect-ratio-standard);
|
|
|
|
}
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
clear: both;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
2018-12-03 22:05:48 +01:00
|
|
|
|
2019-02-07 21:22:04 +01:00
|
|
|
@mixin tick {
|
|
|
|
min-height: 2rem;
|
|
|
|
align-items: center;
|
2019-02-07 21:56:52 +01:00
|
|
|
align-self: start;
|
2019-02-07 21:22:04 +01:00
|
|
|
display: inline-flex;
|
|
|
|
flex-direction: row-reverse;
|
|
|
|
margin-right: var(--spacing-s);
|
|
|
|
margin-bottom: var(--spacing-s);
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
label {
|
2019-03-11 16:41:27 +01:00
|
|
|
color: var(--lbry-teal-4);
|
2019-02-07 21:22:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
label {
|
2019-05-07 17:55:38 +02:00
|
|
|
left: -2rem;
|
|
|
|
padding-left: var(--spacing-l);
|
|
|
|
position: relative;
|
2019-02-07 21:22:04 +01:00
|
|
|
transition: color 0.2s;
|
2019-05-07 17:55:38 +02:00
|
|
|
z-index: 1;
|
2019-02-07 21:22:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin tick-toggle {
|
|
|
|
width: var(--spacing-m); height: var(--spacing-m);
|
|
|
|
top: 0; left: 0;
|
|
|
|
|
|
|
|
border: 2px solid;
|
|
|
|
display: block;
|
|
|
|
position: relative;
|
|
|
|
transition: border 0.2s;
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
width: 100%; height: 100%;
|
|
|
|
top: 0; left: 0;
|
|
|
|
|
|
|
|
content: "";
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-11 16:41:27 +01:00
|
|
|
@mixin underline($text-color: var(--lbry-black), $whitespace-color: var(--lbry-white)) {
|
2018-12-03 22:05:48 +01:00
|
|
|
@include selection($text-color, $whitespace-color);
|
|
|
|
|
|
|
|
background-image: linear-gradient($whitespace-color, $whitespace-color), linear-gradient($whitespace-color, $whitespace-color), linear-gradient($text-color, $text-color);
|
|
|
|
background-position: 0 88%, 100% 88%, 0 88%;
|
|
|
|
background-repeat: no-repeat, no-repeat, repeat-x;
|
|
|
|
background-size: 0.05rem 1px, 0.05rem 1px, 1px 1px;
|
|
|
|
box-decoration-break: clone;
|
|
|
|
display: inline;
|
|
|
|
text-decoration: none;
|
|
|
|
text-shadow: 0.03rem 0 $whitespace-color, -0.03rem 0 $whitespace-color, 0 0.03rem $whitespace-color, 0 -0.03rem $whitespace-color, 0.06rem 0 $whitespace-color, -0.06rem 0 $whitespace-color, 0.09rem 0 $whitespace-color, -0.09rem 0 $whitespace-color, 0.12rem 0 $whitespace-color, -0.12rem 0 $whitespace-color, 0.15rem 0 $whitespace-color, -0.15rem 0 $whitespace-color;
|
|
|
|
|
|
|
|
@-moz-document url-prefix() { // sass-lint:disable-line empty-args
|
|
|
|
background-position: 0 90%, 100% 90%, 0 90%;
|
|
|
|
}
|
|
|
|
}
|