2020-04-30 10:18:12 +00:00
|
|
|
// Converts a font-size in px to rem and optionally sets a relative line-height.
|
2018-11-21 16:33:21 +00:00
|
|
|
@mixin font-size($sizeValue: 16, $lineHeight: false ) {
|
|
|
|
font-size: $sizeValue + px;
|
|
|
|
font-size: ($sizeValue / 16) + rem;
|
|
|
|
@if ($lineHeight) {
|
2020-04-30 10:18:12 +00:00
|
|
|
line-height: $lineHeight / $sizeValue;
|
2018-11-21 16:33:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@mixin hover-state {
|
|
|
|
&:hover,
|
|
|
|
&:active,
|
|
|
|
&:focus {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-15 14:55:57 +00:00
|
|
|
@keyframes loading-fade {
|
|
|
|
0% {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
50% {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-21 16:33:21 +00:00
|
|
|
// Adds animation to placeholder section
|
2019-11-01 13:56:14 +00:00
|
|
|
@mixin placeholder() {
|
|
|
|
animation: loading-fade 1.2s ease-in-out infinite;
|
|
|
|
background-color: $core-grey-light-500 !important;
|
2020-02-26 15:49:07 +00:00
|
|
|
border-color: $core-grey-light-500 !important;
|
|
|
|
color: $core-grey-light-500 !important;
|
2019-11-01 13:56:14 +00:00
|
|
|
box-shadow: none;
|
2020-02-26 15:49:07 +00:00
|
|
|
pointer-events: none;
|
2018-11-21 16:33:21 +00:00
|
|
|
|
2020-02-26 15:49:07 +00:00
|
|
|
// Forces direct descendants to keep layout but lose visibility.
|
|
|
|
> * {
|
|
|
|
visibility: hidden;
|
2018-11-21 16:33:21 +00:00
|
|
|
}
|
2019-08-15 14:55:57 +00:00
|
|
|
|
|
|
|
@media screen and (prefers-reduced-motion: reduce) {
|
|
|
|
animation: none;
|
|
|
|
}
|
2018-11-21 16:33:21 +00:00
|
|
|
}
|
|
|
|
|
2020-02-26 15:49:07 +00:00
|
|
|
@mixin force-content() {
|
|
|
|
&::after {
|
|
|
|
content: "\00a0";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-21 16:33:21 +00:00
|
|
|
// Adds animation to transforms
|
|
|
|
@mixin animate-transform( $duration: 0.2s ) {
|
|
|
|
transition: transform ease $duration;
|
|
|
|
|
|
|
|
@media screen and (prefers-reduced-motion: reduce) {
|
|
|
|
transition: none;
|
|
|
|
}
|
|
|
|
}
|
2018-11-29 18:10:08 +00:00
|
|
|
|
|
|
|
// Hide an element from sighted users, but availble to screen reader users.
|
|
|
|
@mixin visually-hidden() {
|
|
|
|
clip: rect(1px, 1px, 1px, 1px);
|
|
|
|
clip-path: inset(50%);
|
|
|
|
height: 1px;
|
|
|
|
width: 1px;
|
|
|
|
margin: -1px;
|
|
|
|
overflow: hidden;
|
|
|
|
/* Many screen reader and browser combinations announce broken words as they would appear visually. */
|
2018-11-30 21:37:58 +00:00
|
|
|
overflow-wrap: normal !important;
|
2018-11-29 18:10:08 +00:00
|
|
|
word-wrap: normal !important;
|
|
|
|
}
|
2018-11-30 21:37:58 +00:00
|
|
|
|
|
|
|
// Unhide a visually hidden element
|
|
|
|
@mixin visually-shown() {
|
|
|
|
clip: auto;
|
|
|
|
clip-path: none;
|
|
|
|
height: auto;
|
|
|
|
width: auto;
|
|
|
|
margin: unset;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
2020-01-17 13:46:56 +00:00
|
|
|
|
|
|
|
// Reset <button> style so we can use link style for action buttons.
|
|
|
|
@mixin link-button() {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
border: 0;
|
2020-04-14 11:43:10 +00:00
|
|
|
border-radius: 0;
|
2020-01-17 13:46:56 +00:00
|
|
|
|
2020-04-14 11:43:10 +00:00
|
|
|
box-shadow: none;
|
|
|
|
display: inline;
|
|
|
|
font-family: inherit;
|
2020-01-17 13:46:56 +00:00
|
|
|
font-size: inherit;
|
2020-04-14 11:43:10 +00:00
|
|
|
font-weight: inherit;
|
|
|
|
letter-spacing: inherit;
|
2020-04-03 13:22:56 +00:00
|
|
|
text-decoration: underline;
|
2020-04-14 11:43:10 +00:00
|
|
|
text-transform: none;
|
|
|
|
vertical-align: baseline;
|
2020-01-17 13:46:56 +00:00
|
|
|
|
|
|
|
background: transparent;
|
2020-04-14 11:43:10 +00:00
|
|
|
&:hover,
|
|
|
|
&:focus,
|
|
|
|
&:active {
|
2020-01-17 13:46:56 +00:00
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
}
|
2020-04-24 12:23:25 +00:00
|
|
|
|
|
|
|
// Makes sure long words are broken if they overflow the container.
|
|
|
|
@mixin wrapBreakWord {
|
|
|
|
// This is the current standard, works in most browsers.
|
|
|
|
overflow-wrap: anywhere;
|
|
|
|
// Safari supports word-break.
|
|
|
|
word-break: break-word;
|
|
|
|
// IE11 doesn't support overflow-wrap neither word-break: break-word, so we fallback to -ms-work-break: break-all.
|
|
|
|
-ms-word-break: break-all;
|
|
|
|
}
|
2020-04-30 10:18:12 +00:00
|
|
|
|
|
|
|
@function rem($size, $base: 16px ) {
|
|
|
|
@return $size / $base * 1rem;
|
|
|
|
}
|