Skip to content

Commit

Permalink
fix(docs): cannot get theme config
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Apr 1, 2024
1 parent 133c3d3 commit 40ae612
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 28 deletions.
10 changes: 5 additions & 5 deletions docs/components/LogoHeader.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div style={{ display: "flex", alignItems: "center", gap: "2px" }}>
<MainIcon width={40} height={40}/>
<MainIcon width={40} height={40} />
<span style={{ fontWeight: 800, fontSize: "30px", color }}>
GZ<span style={{ color: highlightColor }}>::</span>CTF
</span>
Expand Down
7 changes: 4 additions & 3 deletions docs/components/icon/MainIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTheme } from "nextra-theme-docs";
import { SVGProps, FC } from "react";
import { useTheme } from "next-themes";

interface MainIconProps extends SVGProps<SVGSVGElement> {
ignoreTheme?: boolean;
Expand All @@ -9,8 +9,9 @@ const MainIcon: FC<MainIconProps> = (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 (
<svg width="480" height="480" viewBox="0 0 4800 4800" {...svgProps}>
Expand Down
1 change: 0 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/index.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand All @@ -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)
2 changes: 1 addition & 1 deletion docs/pages/index.ja.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion docs/pages/index.zh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 0 additions & 13 deletions docs/pnpm-lock.yaml

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

0 comments on commit 40ae612

Please sign in to comment.