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

feat: doc style #7

Merged
merged 4 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 95 additions & 46 deletions docusaurus/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

#__docusaurus {
padding: 16px 120px 0;
background-image: linear-gradient(180deg, #d8e2ee 0%, #d8e2ee 100%);
cursor: pointer;
background-color: transparent;
cursor: pointer !important;
}

/* Sidebar Style */
Expand All @@ -64,6 +64,16 @@
color: #424e66 !important;
}

.menu__list-item-collapsible,
.menu__list-item {
border-radius: 8px;
}

.menu__list-item-collapsible > a,
.menu__list-item > a {
line-height: 22px;
}

.menu__link--active {
background: #0e0b3b0d;
border-radius: 8px;
Expand All @@ -73,8 +83,17 @@
font-weight: 500;
}

.clean-btn::before {
background-size: 1rem 1rem;
}

.sidebarViewport_aRkj::-webkit-scrollbar {
display: none; /* 隐藏滚动条 */
}
.sidebarViewport_aRkj {
overflow-y: auto !important;
-ms-overflow-style: none; /* IE 和 Edge */
scrollbar-width: none; /* Firefox */
overflow-y: auto !important; /* 保持内容可滚动 */
}

/* Docs container Style */
Expand All @@ -83,53 +102,83 @@
border-radius: 12px;
padding: 14px 32px;
font-size: 14px !important;
}

.markdown > h2,
.markdown > h3,
.markdown > h4,
.markdown > h5 {
color: #292d3b !important;
font-weight: 600 !important;
}

.markdown h1:first-child {
font-size: 26px !important;
color: #292d3b !important;
font-weight: 600 !important;
}

.markdown > h2 {
font-size: 20px !important;
margin-top: 28px !important;
}

.markdown > h3 {
font-size: 18px !important;
}
.markdown > h4 {
font-size: 16px !important;
}
.markdown > h5 {
font-size: 14px !important;
}

.markdown > a {
font-size: 14px !important;
color: #2e5dfe !important;
}

h1 {
font-size: 24px !important;
color: #1a1b25e0 !important;
line-height: 32px !important;
font-weight: 600 !important;
}

h2 {
font-size: 24px !important;
color: #1a1b25e0 !important;
line-height: 32px !important;
font-weight: 600 !important;
margin-top: 28px !important;
}

p,
th,
td,
li,
span {
font-size: 14px !important;
color: #1a1b25e0 !important;
line-height: 22px !important;
}

a {
font-size: 14px !important;
color: #1677ff !important;
}
.breadcrumbs__item:not(:last-child):after {
content: "/";
background: none;
margin: 0 0 0 5px !important;
font-size: 14px !important;
}

.breadcrumbs__link {
background-color: transparent !important;
font-size: 12px !important;
color: #0a0a0ae1 !important;
line-height: 20px;
padding: 0;
}
.breadcrumbs__item:not(:last-child):after {
content: "/";
background: none;
margin: 0 0 0 5px !important;
font-size: 14px !important;
}

.breadcrumbs__link {
background-color: transparent !important;
font-size: 12px !important;
color: #0a0a0ae1 !important;
line-height: 20px;
padding: 0;
}

.markdown p,
.markdown th,
.markdown td,
.markdown li,
.markdown span {
font-size: 14px !important;
color: #1a1b25e0 !important;
line-height: 22px !important;
}

.table-of-contents li > a {
font-size: 14px;
color: #768191;
}

.table-of-contents > li > .table-of-contents__link--active {
font-size: 14px;
color: #2e5dfe;
font-weight: 500;
}

/* Cascader style */

.ant-cascader-menu {
height: fit-content !important;
}
.itemWrapper {
display: flex;
flex-direction: column;
Expand Down
31 changes: 19 additions & 12 deletions docusaurus/src/theme/DocBreadcrumbs/Items/Home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import Link from '@docusaurus/Link';
import { translate } from '@docusaurus/Translate';
import React from "react";
import Link from "@docusaurus/Link";
import { translate } from "@docusaurus/Translate";

import { useLocation } from '@docusaurus/router';
import { useLocation } from "@docusaurus/router";

export default function HomeBreadcrumbItem(): JSX.Element {
const { pathname } = useLocation();
Expand All @@ -23,20 +23,27 @@ export default function HomeBreadcrumbItem(): JSX.Element {
}
};

const homeText = () => {
const lang =
pathname?.split("/")?.find((item) => ["zh", "en"].includes(item)) || "en";
if (lang === "en") {
return "Docs";
}
return "文档";
};

return (
<li className="breadcrumbs__item">
<Link
aria-label={translate({
id: 'theme.docs.breadcrumbs.home',
message: 'Home page',
description: 'The ARIA label for the home page in the breadcrumbs',
id: "theme.docs.breadcrumbs.home",
message: "Home page",
description: "The ARIA label for the home page in the breadcrumbs",
})}
className="breadcrumbs__link"

href={homeHref()}>
<div style={{ color: '#1a1b2572' }}>
文档
</div>
href={homeHref()}
>
<div style={{ color: "#1a1b2572" }}>{homeText()}</div>
</Link>
</li>
);
Expand Down
Loading