fix: light mode (#4423)

Co-authored-by: Anshuman Pandey <54475686+pandeymangg@users.noreply.github.com>
This commit is contained in:
Dhruwang Jariwala
2024-12-09 17:23:36 +05:30
committed by GitHub
parent 1e95b8cf9e
commit f344715381
3 changed files with 98 additions and 244 deletions

View File

@@ -2,56 +2,58 @@
import { Button } from "@/components/Button";
import { LoadingSpinner } from "@/components/icons/LoadingSpinner";
import { useTheme } from "next-themes";
import { useState } from "react";
import { RedocStandalone } from "redoc";
import "./style.css";
const redocTheme = {
hideDownloadButton: true,
hideLoading: true,
nativeScrollbars: true,
theme: {
sidebar: {
backgroundColor: "transparent",
textColor: "rgb(203, 213, 225)",
activeTextColor: "#2dd4bf",
},
rightPanel: {
backgroundColor: "transparent",
},
colors: {
primary: { main: "#2dd4bf" },
text: {
primary: "rgb(203, 213, 225)",
secondary: "rgb(203, 213, 225)",
},
responses: {
success: { color: "#22c55e" },
error: { color: "#ef4444" },
info: { color: "#3b82f6" },
},
},
typography: {
fontSize: "16px",
lineHeight: "2rem",
fontFamily: "Jost, system-ui, -apple-system, sans-serif",
headings: {
fontFamily: "Jost, system-ui, -apple-system, sans-serif",
fontWeight: "600",
},
code: {
fontSize: "16px",
fontFamily: "ui-monospace, monospace",
},
},
codeBlock: {
backgroundColor: "rgb(24, 35, 58)",
},
spacing: { unit: 5 },
},
};
export const ApiDocs = () => {
const { resolvedTheme } = useTheme();
const redocTheme = {
hideDownloadButton: true,
hideLoading: true,
nativeScrollbars: true,
theme: {
sidebar: {
backgroundColor: "transparent",
textColor: resolvedTheme === "dark" ? "rgb(203, 213, 225)" : "rgb(51, 51, 51)",
activeTextColor: "#2dd4bf",
},
rightPanel: {
backgroundColor: "transparent",
},
colors: {
primary: { main: "#2dd4bf" },
text: {
primary: resolvedTheme === "dark" ? "#ffffff" : "rgb(51, 51, 51)",
},
responses: {
success: { color: "#22c55e" },
error: { color: "#ef4444" },
info: { color: "#3b82f6" },
},
},
typography: {
fontSize: "16px",
lineHeight: "2rem",
fontFamily: "Jost, system-ui, -apple-system, sans-serif",
headings: {
fontFamily: "Jost, system-ui, -apple-system, sans-serif",
fontWeight: "600",
},
code: {
fontSize: "16px",
fontFamily: "ui-monospace, monospace",
},
},
codeBlock: {
backgroundColor: "rgb(24, 35, 58)",
},
spacing: { unit: 5 },
},
};
const [loading, setLoading] = useState(true);
return (

View File

@@ -1,21 +1,29 @@
:root[data-theme="light"] {
--text-color: rgb(51, 65, 85);
}
:root[data-theme="dark"] {
--text-color: rgb(203, 213, 225);
}
h5,
.sc-dhCplO,
.sc-dpBQxM {
color: rgb(203, 213, 225) !important;
color: var(--text-color) !important;
}
.tab-success,
.react-tabs__tab,
.tab-error {
background-color: transparent !important;
border: 1px solid rgb(203, 213, 225) !important;
border: 1px solid var(--text-color) !important;
margin: 10px 5px !important;
}
.sc-dwGkES,
.sc-ePpfBx {
background-color: rgb(24, 24, 27) !important;
border: 1px solid rgb(203, 213, 225) !important;
border: 1px solid var(--text-color) !important;
}
.sc-ePpfBx,
.corVrN {