mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-10-23 12:54:25 -04:00
add scroll-margin-top
property to content sub-headings (fixes #717)
This commit is contained in:
@@ -10,16 +10,12 @@ module.exports = withBundleAnalyzer({
|
|||||||
i18n: {
|
i18n: {
|
||||||
locales: ["en-us"],
|
locales: ["en-us"],
|
||||||
defaultLocale: "en-us",
|
defaultLocale: "en-us",
|
||||||
|
localeDetection: false,
|
||||||
},
|
},
|
||||||
swcMinify: true,
|
swcMinify: true,
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
trailingSlash: true,
|
trailingSlash: true,
|
||||||
productionBrowserSourceMaps: true,
|
productionBrowserSourceMaps: true,
|
||||||
resolve: {
|
|
||||||
fallback: {
|
|
||||||
fs: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
images: {
|
images: {
|
||||||
formats: ["image/webp"],
|
formats: ["image/webp"],
|
||||||
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
|
||||||
|
@@ -150,8 +150,7 @@ export default function App({ Component, pageProps }: AppProps) {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Inline script to restore light/dark theme preference ASAP */}
|
{/* Inline script to restore light/dark theme preference ASAP */}
|
||||||
<Script id="restore_theme" strategy="afterInteractive">{`
|
<Script id="restore_theme" strategy="afterInteractive">{`try {
|
||||||
try {
|
|
||||||
var root = document.documentElement,
|
var root = document.documentElement,
|
||||||
pref = localStorage.getItem("dark_mode"),
|
pref = localStorage.getItem("dark_mode"),
|
||||||
theme = pref === "true" || (!pref && window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light";
|
theme = pref === "true" || (!pref && window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light";
|
||||||
|
@@ -114,29 +114,33 @@ code {
|
|||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnchorJS styles
|
// sub-heading anchor styles
|
||||||
.h-anchor {
|
.h-anchor {
|
||||||
margin: 0 0.25em;
|
margin: 0 0.25em;
|
||||||
padding: 0 0.25em;
|
padding: 0 0.25em;
|
||||||
color: var(--medium-light) !important;
|
color: var(--medium-light);
|
||||||
background: none !important;
|
background: none;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
opacity: 0; // overridden by JS on mobile devices
|
opacity: 0; // overridden on hover
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: "\0023"; // pound sign
|
content: "\0023"; // pound sign `#`, done here to keep content DOM cleaner
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--link) !important;
|
color: var(--link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make anchor `#` link show up on hover over the corresponding heading
|
||||||
h2,
|
h2,
|
||||||
h3,
|
h3,
|
||||||
h4 {
|
h4 {
|
||||||
|
// offset (approximately) with sticky header so jumped-to content isn't hiding behind it
|
||||||
|
scroll-margin-top: 90px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
.h-anchor {
|
.h-anchor {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
Reference in New Issue
Block a user