Skip to content

Commit 25a6854

Browse files
authored
fix: ssg error of style tag in ssg rendered html (#44)
1 parent fb808ee commit 25a6854

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

src/background-image/global.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:root {
2+
--rp-c-bg: #0b0c0e;
3+
}
4+
:root:not(.dark) {
5+
--rp-c-bg: #fff;
6+
}
7+
.rspress-nav {
8+
transition: background 0.4s;
9+
}
10+
body:not(.notTopArrived) .rspress-nav {
11+
background: transparent !important;
12+
}

src/background-image/index.tsx

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { type FC, useEffect, useState } from 'react';
22
import styles from './index.module.scss';
3+
import './global.scss';
34

45
const useTopArrived = () => {
56
const [scrollY, setScrollY] = useState(0);
@@ -44,27 +45,10 @@ export const BackgroundImage: FC<BackgroundProps> = ({
4445
}, [topArrived, navBarTopArrived]);
4546

4647
return (
47-
<>
48-
<style>
49-
{`:root {
50-
--rp-c-bg: #0b0c0e;
51-
}
52-
:root:not(.dark) {
53-
--rp-c-bg: #fff;
54-
}
55-
.rspress-nav {
56-
transition: background 0.4s;
57-
}
58-
body:not(.notTopArrived) .rspress-nav {
59-
background: transparent !important;
60-
}
61-
`}
62-
</style>
63-
<img
64-
className={styles.background}
65-
src="https://assets.rspack.rs/rspack/assets/landingpage-background-compressed.png"
66-
alt="background"
67-
/>
68-
</>
48+
<img
49+
className={styles.background}
50+
src="https://assets.rspack.rs/rspack/assets/landingpage-background-compressed.png"
51+
alt="background"
52+
/>
6953
);
7054
};

0 commit comments

Comments
 (0)