Skip to content

Commit

Permalink
chore(deps): upgrade @rstack-dev/doc-ui 1.4.0 (#7765)
Browse files Browse the repository at this point in the history
feat: new landingpage
  • Loading branch information
SoonIter authored Sep 2, 2024
1 parent d4fc161 commit f9820e4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 228 deletions.
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"license": "MIT",
"packageManager": "pnpm@9.3.0",
"dependencies": {
"@rstack-dev/doc-ui": "1.3.2",
"@rstack-dev/doc-ui": "1.4.0",
"antd": "5.19.3",
"axios": "^1.6.1",
"date-fns": "^2.29.3",
Expand Down
10 changes: 5 additions & 5 deletions website/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 2 additions & 57 deletions website/theme/components/Landingpage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BackgroundImage } from '@rstack-dev/doc-ui/background-image';
import { useEffect, useState } from 'react';
import { Benchmark } from './Benchmark';
import BuiltWithRspack from './BuiltWithRspack';
Expand All @@ -7,66 +8,10 @@ import ToolStack from './ToolStack';
import WhyRspack from './WhyRspack';
import styles from './index.module.scss';

const Background = () => {
return (
<img
className={styles.background}
src="https://assets.rspack.dev/rspack/assets/landingpage-background-compressed.png"
alt="background"
/>
);
};

const useTopArrived = () => {
const [scrollY, setScrollY] = useState(0);
const topArrived = scrollY < 100;

useEffect(() => {
const handleScroll = () => {
setScrollY(window.scrollY);
};
window.addEventListener('scroll', handleScroll, {
capture: false,
passive: true,
});
return () => {
window.removeEventListener('scroll', handleScroll);
};
}, []);

return {
topArrived,
};
};

const LandingPage = () => {
const { topArrived } = useTopArrived();
useEffect(() => {
if (topArrived) {
document.body.classList.remove('notTopArrived');
} else {
document.body.classList.add('notTopArrived');
}
}, [topArrived]);

return (
<div className={styles.landingPage}>
<style>
{`:root {
--rp-c-bg: #0b0c0e;
}
:root:not(.dark) {
--rp-c-bg: #fff;
}
.rspress-nav {
transition: background 0.4s;
}
body:not(.notTopArrived) .rspress-nav {
background: transparent !important;
}
`}
</style>
<Background />
<BackgroundImage />
<Hero />
<WhyRspack />
<Benchmark />
Expand Down
165 changes: 0 additions & 165 deletions website/theme/components/Landingpage/shared.module.scss

This file was deleted.

0 comments on commit f9820e4

Please sign in to comment.