1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 14:16:20 -04:00
jarv.is/assets/sass/components/_global.scss
Jake Jarvis b755b66d19
use preact for common components across site (#663)
* convert GitHub cards grid from lit-html to preact

* give hit counter the preact treatment

* extract loading spinner component to a shared location

* move *some* loading spinner styles to its JSX

* Update .percy.yml

* pick up images in JS w/ webpack

* pull star/fork icons straight from @primer/octicons

* a bit of cleanup

* check `typeof window !== "undefined"` before rendering

* bump misc. deps

* silence missing license warnings for preact-hooks and preact-compat

* add source-map-loader

* Update loading.js
2021-11-24 13:51:29 -05:00

193 lines
4.2 KiB
SCSS

@use "sass:map";
@use "../abstracts/settings";
@use "../abstracts/themes";
@use "../abstracts/functions";
// Global Styles
body {
width: 100%;
height: 100%;
margin: 0 auto;
scroll-behavior: smooth;
font-family: settings.$font-stack-sans;
font-kerning: normal;
font-variant-ligatures: normal;
font-feature-settings: "kern", "liga", "calt", "clig", "ss01";
// global base font size:
font-size: 0.975em;
line-height: 1.5;
@include themes.themed(
(
background-color: "background-outer",
)
);
// set themed lightbulb icons manually
&.light button.dark-mode-toggle {
background-image: url(themes.$icon-bulb-on);
}
&.dark button.dark-mode-toggle {
background-image: url(themes.$icon-bulb-off);
}
}
code,
pre,
.monospace {
font-family: settings.$font-stack-mono;
letter-spacing: normal;
}
// override above font-family if browser supports variable fonts
// https://caniuse.com/#feat=variable-fonts
@supports (font-variation-settings: normal) {
body {
font-family: settings.$font-stack-sans-variable;
font-optical-sizing: auto;
}
code,
pre,
.monospace {
font-family: settings.$font-stack-mono-variable;
}
// Chrome doesn't automatically slant multi-axis Inter var, for some reason.
// Adding "slnt" -10 fixes Chrome but then over-italicizes in Firefox. AHHHHHHHHHH.
em {
font-style: normal !important;
font-variation-settings: "ital" 1, "slnt" -10;
// Roboto Mono doesn't have this problem, but the above fix breaks it, of course.
code,
pre,
.monospace {
font-style: italic !important;
}
}
}
a {
text-decoration: none;
}
// this is what's extended by different layouts (in ../pages)
div.layout {
max-width: settings.$max-width;
margin: 0 auto;
display: block; // https://stackoverflow.com/questions/28794718/max-width-not-working-for-ie-11
}
// stretch background for entire width of content area
main {
width: 100%;
padding: 0 1.5em;
@include themes.themed(
(
color: "text",
background-color: "background-inner",
)
);
a {
background-position: 0% 100%;
background-repeat: no-repeat;
background-size: 0% settings.$link-underline-size;
padding-bottom: settings.$link-underline-size;
@include themes.themed(
$properties: (
color: "links",
),
$moreTransitions: (
background-size 0.25s ease-in-out,
)
);
// cool link underlines via messy SCSS hacking (see ../abstracts/_functions)
@each $theme, $map in themes.$themes {
@at-root body.#{$theme} #{&} {
background-image: functions.underline-hack(map.get($map, "links"), map.get($map, "background-inner"));
}
}
&:hover {
background-size: 100% settings.$link-underline-size;
}
// set an anchor's class to `no-underline` to disable all of this
&.no-underline {
background: none !important;
padding-bottom: 0;
}
}
// page titles
h1 {
margin-top: 0;
letter-spacing: -0.005em;
// stylelint-disable-next-line no-descending-specificity
a {
// disable fancy underline without `.no-underline`
color: inherit !important;
background: none !important;
padding-bottom: 0;
}
}
}
// make SVG twemojis relative to surrounding text
// https://github.com/twitter/twemoji#inline-styles
img.emoji {
height: 1.2em;
width: 1.2em;
margin: 0 0.05em;
vertical-align: -0.22em;
border: 0;
display: inline-block;
// have cursor act like it's hovering a regular unicode emoji, especially since twemojis can still be copied/pasted
cursor: text;
}
// need to manually unset text cursor above when emoji's within a link
a img.emoji {
cursor: inherit;
}
// pulsating loading spinner
.loading {
display: inline-block;
> div {
@include themes.themed(
(
background-color: "medium-light",
)
);
}
}
// Responsive
@mixin responsive() {
body {
// Safari iOS menu bar reappears below 44px:
// https://www.eventbrite.com/engineering/mobile-safari-why/
padding-bottom: 45px !important;
// Allows you to scroll below the viewport; default value is visible
overflow-y: scroll;
}
main {
padding-left: 1.25em;
padding-right: 1.25em;
}
}