mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
refactor: enable scroll-smooth only in post detail page
This commit is contained in:
@@ -13,6 +13,7 @@ export interface Props {
|
|||||||
canonicalURL?: string;
|
canonicalURL?: string;
|
||||||
pubDatetime?: Date;
|
pubDatetime?: Date;
|
||||||
modDatetime?: Date;
|
modDatetime?: Date;
|
||||||
|
scrollSmooth?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -23,6 +24,7 @@ const {
|
|||||||
canonicalURL = new URL(Astro.url.pathname, Astro.site).href,
|
canonicalURL = new URL(Astro.url.pathname, Astro.site).href,
|
||||||
pubDatetime,
|
pubDatetime,
|
||||||
modDatetime,
|
modDatetime,
|
||||||
|
scrollSmooth = false,
|
||||||
} = Astro.props;
|
} = Astro.props;
|
||||||
|
|
||||||
const socialImageURL = new URL(
|
const socialImageURL = new URL(
|
||||||
@@ -32,7 +34,10 @@ const socialImageURL = new URL(
|
|||||||
---
|
---
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang=`${LOCALE.lang ?? "en"}`>
|
<html
|
||||||
|
lang=`${LOCALE.lang ?? "en"}`
|
||||||
|
class={`${scrollSmooth && "scroll-smooth"}`}
|
||||||
|
>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ const layoutProps = {
|
|||||||
modDatetime,
|
modDatetime,
|
||||||
canonicalURL,
|
canonicalURL,
|
||||||
ogImage: ogUrl,
|
ogImage: ogUrl,
|
||||||
|
scrollSmooth: true,
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,6 @@
|
|||||||
--color-card-muted: 138, 51, 2;
|
--color-card-muted: 138, 51, 2;
|
||||||
--color-border: 171, 75, 8;
|
--color-border: 171, 75, 8;
|
||||||
}
|
}
|
||||||
html {
|
|
||||||
scroll-behavior: smooth;
|
|
||||||
}
|
|
||||||
#sun-svg,
|
#sun-svg,
|
||||||
html[data-theme="dark"] #moon-svg {
|
html[data-theme="dark"] #moon-svg {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user