From 40ae612e31e01e9ad0b8f6fe00f0480c300775b0 Mon Sep 17 00:00:00 2001 From: GZTime Date: Mon, 1 Apr 2024 14:09:11 +0800 Subject: [PATCH] fix(docs): cannot get theme config --- docs/components/LogoHeader.tsx | 10 +++++----- docs/components/icon/MainIcon.tsx | 7 ++++--- docs/package.json | 1 - docs/pages/index.en.mdx | 8 ++++---- docs/pages/index.ja.mdx | 2 +- docs/pages/index.zh.mdx | 2 +- docs/pnpm-lock.yaml | 13 ------------- 7 files changed, 15 insertions(+), 28 deletions(-) diff --git a/docs/components/LogoHeader.tsx b/docs/components/LogoHeader.tsx index d2837aebe..cdcc78b19 100644 --- a/docs/components/LogoHeader.tsx +++ b/docs/components/LogoHeader.tsx @@ -1,16 +1,16 @@ import { FC } from "react"; import MainIcon from "@Components/icon/MainIcon"; -import { useTheme } from "next-themes"; +import { useTheme } from "nextra-theme-docs"; export const LogoHeader: FC = () => { const { resolvedTheme } = useTheme(); - const isDark = resolvedTheme === "dark"; - const color = isDark ? "#fff" : "#414141"; - const highlightColor = isDark ? "#0AD7AF" : "#02BFA5"; + const darkMode = resolvedTheme === "dark"; + const color = darkMode ? "#fff" : "#414141"; + const highlightColor = darkMode ? "#0AD7AF" : "#02BFA5"; return (
- + GZ::CTF diff --git a/docs/components/icon/MainIcon.tsx b/docs/components/icon/MainIcon.tsx index 86738a03c..0406c0aad 100644 --- a/docs/components/icon/MainIcon.tsx +++ b/docs/components/icon/MainIcon.tsx @@ -1,5 +1,5 @@ +import { useTheme } from "nextra-theme-docs"; import { SVGProps, FC } from "react"; -import { useTheme } from "next-themes"; interface MainIconProps extends SVGProps { ignoreTheme?: boolean; @@ -9,8 +9,9 @@ const MainIcon: FC = (props: MainIconProps) => { const { ignoreTheme, ...svgProps } = props; const { resolvedTheme } = useTheme(); - const isDark = resolvedTheme === "dark"; - const color = isDark ? "#fff" : "#414141"; + const color = resolvedTheme === "dark" ? "#fff" : "#414141"; + + console.log("color", color, resolvedTheme); return ( diff --git a/docs/package.json b/docs/package.json index d640b01fd..cd8c2eef9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -10,7 +10,6 @@ "dependencies": { "@vercel/analytics": "^1.2.2", "next": "^14.1.4", - "next-themes": "^0.3.0", "nextra": "^2.13.4", "nextra-theme-docs": "^2.13.4", "react": "^18.2.0", diff --git a/docs/pages/index.en.mdx b/docs/pages/index.en.mdx index 4e70a3bf5..cf835f4b1 100644 --- a/docs/pages/index.en.mdx +++ b/docs/pages/index.en.mdx @@ -27,19 +27,19 @@ During the rapid development of new features, it is not recommended to use the ` - Dynamic Container: Automatically generate and issue flags through container environment variables, and flag of each team is unique. - Dynamic Scores - + - Curve of scores: $$ f(S, r, d, x) = \left \lfloor S \times \left[r + ( 1- r) \times \exp\left( \dfrac{1 - x}{d} \right) \right] \right \rfloor $$ Where $S$ is the original score, $r$ is the minimum score ratio, $d$ is the difficulty coefficient, and $x$ is the number of submissions. The first three parameters can be customized to satisfy most of the dynamic score requirements. - - Bonus for first three solves: + - Bonus for first three solves: The platform rewards 5%, 3%, and 1% of the current score for the first three solves respectively. - Disable or enable challenges during the competition, and release new challenges at any time. - Dynamic flag sharing detection, optional flag template, leet flag - + - **Teams** score timeline, scoreboard. Teams can be grouped - Dynamic container distribution, management, and multiple port mapping methods based on **Docker or K8s** @@ -57,4 +57,4 @@ During the rapid development of new features, it is not recommended to use the ` ## Stars ✨ -[![Stargazers over time](https://starchart.cc/GZTimeWalker/GZCTF.svg)](https://starchart.cc/GZTimeWalker/GZCTF) +[![Stargazers over time](https://starchart.cc/GZTimeWalker/GZCTF.svg?variant=adaptive)](https://starchart.cc/GZTimeWalker/GZCTF) diff --git a/docs/pages/index.ja.mdx b/docs/pages/index.ja.mdx index ae04ba2cd..c0cc721e0 100644 --- a/docs/pages/index.ja.mdx +++ b/docs/pages/index.ja.mdx @@ -56,4 +56,4 @@ GZ::CTF は AGPLv3 契約に基づいたオープンソースであり、その ## Stars ✨ -[![Stargazers over time](https://starchart.cc/GZTimeWalker/GZCTF.svg)](https://starchart.cc/GZTimeWalker/GZCTF) +[![Stargazers over time](https://starchart.cc/GZTimeWalker/GZCTF.svg?variant=adaptive)](https://starchart.cc/GZTimeWalker/GZCTF) diff --git a/docs/pages/index.zh.mdx b/docs/pages/index.zh.mdx index cd31926d7..bfedb9cac 100644 --- a/docs/pages/index.zh.mdx +++ b/docs/pages/index.zh.mdx @@ -56,4 +56,4 @@ GZ::CTF 基于 AGPLv3 协议开源,使用和修改均需遵守开源协议。 ## Stars ✨ -[![Stargazers over time](https://starchart.cc/GZTimeWalker/GZCTF.svg)](https://starchart.cc/GZTimeWalker/GZCTF) +[![Stargazers over time](https://starchart.cc/GZTimeWalker/GZCTF.svg?variant=adaptive)](https://starchart.cc/GZTimeWalker/GZCTF) diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index b7f744639..5fcd94a10 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -11,9 +11,6 @@ dependencies: next: specifier: ^14.1.4 version: 14.1.4(react-dom@18.2.0)(react@18.2.0) - next-themes: - specifier: ^0.3.0 - version: 0.3.0(react-dom@18.2.0)(react@18.2.0) nextra: specifier: ^2.13.4 version: 2.13.4(next@14.1.4)(react-dom@18.2.0)(react@18.2.0) @@ -2094,16 +2091,6 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false - /next-themes@0.3.0(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-/QHIrsYpd6Kfk7xakK4svpDI5mmXP0gfvCoJdGpZQ2TOrQZmsW0QxjaiLn8wbIKjtm4BTSqLoix4lxYYOnLJ/w==} - peerDependencies: - react: ^16.8 || ^17 || ^18 - react-dom: ^16.8 || ^17 || ^18 - dependencies: - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - dev: false - /next@14.1.4(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-1WTaXeSrUwlz/XcnhGTY7+8eiaFvdet5z9u3V2jb+Ek1vFo0VhHKSAIJvDWfQpttWjnyw14kBeq28TPq7bTeEQ==} engines: {node: '>=18.17.0'}