Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix the SSR/CSR mismatch #146

Merged
merged 10 commits into from
Sep 13, 2024
3 changes: 2 additions & 1 deletion .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- main
workflow_dispatch:
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

Expand All @@ -19,6 +20,6 @@ jobs:
- name: Install pnpm
run: npm install -g pnpm@8
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: pnpm i --no-frozen-lockfile --unsafe-perm --ignore-scripts
- name: Test build website
run: pnpm build
13 changes: 13 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ const config = {
},
}),
plugins: [
customPostCssPlugin,
"docusaurus-plugin-sass",
async function TailwindCSSPlugin(context, options) {
return {
Expand All @@ -225,4 +226,16 @@ const config = {
],
};

/** @return {import('@docusaurus/types').Plugin} */
function customPostCssPlugin() {
return {
name: "custom-postcss",
configurePostCss(options) {
// Append new PostCSS plugins here.
options.plugins.push(require("postcss-preset-env")); // allow newest CSS syntax
return options;
}
};
}

module.exports = config;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"documate:upload": "documate upload"
},
"dependencies": {
"postcss-preset-env": "^10.0.3",
"@crowdin/cli": "3",
"@crowdin/crowdin-api-client": "^1.23.4",
"@docusaurus/core": "3.4.0",
Expand Down
20 changes: 7 additions & 13 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Link from "@docusaurus/Link";
import { useColorMode } from "@docusaurus/theme-common";
// import useBaseUrl from '@docusaurus/useBaseUrl';
import ThemedImage from '@theme/ThemedImage';
import Translate from "@docusaurus/Translate";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import Layout from "@theme/Layout";
Expand Down Expand Up @@ -100,8 +101,6 @@ function HomepageHeader() {


const HomeBaseContent = () => {
const { colorMode } = useColorMode();

const mainContent = React.useMemo(() => {
return (
<main className="mb-20 my-10 max-w-7xl mx-auto w-full px-4 sm:px-6 lg:px-8max-w-6xl">
Expand All @@ -112,21 +111,16 @@ const HomeBaseContent = () => {
);
}, []);

if (colorMode === "dark") {
return (
<>
<StarrySky />
{mainContent}
</>
);
} else {
return (
<>
<AuroraBackground />
<ThemedImage sources={{
HsiangNianian marked this conversation as resolved.
Show resolved Hide resolved
light: <StarrySky />,
dark: <AuroraBackground />,
}}
/>
{mainContent}
</>
);
}
};


Expand Down
Loading