完善 docs

This commit is contained in:
SmallMain
2022-06-09 21:29:25 +08:00
parent ce325ea626
commit 0a4bf9fc9a
21 changed files with 427 additions and 84 deletions

View File

@@ -13,9 +13,32 @@
--ifm-color-primary-light: #6440b1;
--ifm-color-primary-lighter: #6943b9;
--ifm-color-primary-lightest: #7b59c3;
--ifm-code-font-size: 90%;
--ifm-code-font-size: 80%;
--ifm-code-padding-horizontal: 0.3rem;
--ifm-global-radius: 0.3rem;
--ifm-code-border-radius: 0.2rem;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
--ifm-h1-font-size: 2.5rem;
--ifm-heading-font-weight: 500;
--ifm-button-font-weight: var(--ifm-heading-font-weight);
--ifm-hr-background-color: var(--ifm-color-emphasis-200);
}
.navbar__title {
font-weight: 500;
}
.navbar__link {
color: var(--ifm-navbar-link-color);
font-weight: var(--ifm-font-weight-normal);
}
.menu {
font-weight: var(--ifm-font-weight-normal);
}
.badge {
font-weight: var(--ifm-font-weight-normal);
}
/* For readability concerns, you should choose a lighter palette in dark mode. */
@@ -34,12 +57,55 @@
:root {
--ifm-font-size-base: 16px;
}
.banner-img {
display: none;
}
}
@media screen and (min-width: 997px) {
:root {
--ifm-font-size-base: 18px;
}
.hero__subtitle {
margin-top: 2rem;
}
.hero__title {
font-size: 4rem;
margin-left: -20px;
}
.markdown h1:first-child {
--ifm-h1-font-size: 2.5rem;
}
.title_node_modules-\@docusaurus-theme-classic-lib-next-theme-DocCategoryGeneratedIndexPage-styles-module {
--ifm-h1-font-size: 2.5rem !important;
}
.markdown {
--ifm-h3-vertical-rhythm-top: 2;
}
hr {
margin-top: 2.5rem;
}
.markdown>h2 {
margin-bottom: calc(var(--ifm-heading-vertical-rhythm-bottom) * var(--ifm-leading) * 1.5);
}
.markdown>h3 {
--ifm-h3-font-size: 1.3rem;
}
}
.menu__caret:before {
background: var(--ifm-menu-link-sublist-icon) 50% / 2rem 1.5rem;
}
html[data-theme=light] .navbar__item.header-github-link {
@@ -53,25 +119,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MjUyLS4xNi4wMjctLjMwNC0uMDM5LS4zMjQtLjE0OS0uMDItLjExLjA5NC0uMjI1LjI1Mi0uMjUyLjE1OC0uMDI3LjMwNC4wMzguMzI0LjE0OHoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=) 0/20px 20px no-repeat;
}
.hero__subtitle {
margin-top: 2rem;
}
.hero__title {
font-size: 4rem;
}
@media screen and (max-width: 996px) {
.banner-img {
display: none;
}
}
.markdown h1:first-child {
--ifm-h1-font-size: 2.5rem;
}
.title_node_modules-\@docusaurus-theme-classic-lib-next-theme-DocCategoryGeneratedIndexPage-styles-module {
--ifm-h1-font-size: 2.5rem !important;
}

View File

@@ -18,23 +18,23 @@ function HomepageHeader() {
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline + ""}</p>
<div>
<p style={{ color: 'var(--ifm-color-primary)', fontWeight: 'bold', marginBottom: 2 }}>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}>2D </span>
</p>
<p style={{ color: 'var(--ifm-color-primary)', fontWeight: 'bold', marginBottom: 2 }}>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}>2D </span>
DPI
</p>
<p style={{ color: 'var(--ifm-color-primary)', fontWeight: 'bold', marginBottom: 2 }}>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}></span>
</p>
<p style={{ color: 'var(--ifm-color-primary)', fontWeight: 'bold', marginBottom: 2 }}>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}>Label </span>
Char
</p>
<p style={{ color: 'var(--ifm-color-primary)', fontWeight: 'bold', marginBottom: 2 }}>
<p style={{ color: 'var(--ifm-color-primary)', marginBottom: 2 }}>
<span className="badge badge--primary" style={{ marginRight: 8 }}>Spine </span>
SpriteFrame
</p>
@@ -47,6 +47,13 @@ function HomepageHeader() {
>
使
</Link>
<Link
className="button button--outline button--primary button--lg"
href='TODO'
style={{ marginRight: 20 }}
>
</Link>
<Link
className="button button--secondary button--lg"
href='https://github.com/smallmain/cocos-service-pack'>

View File

@@ -0,0 +1,87 @@
import React from 'react';
import Link from '@docusaurus/Link';
import {findFirstCategoryLink, useDocById} from '@docusaurus/theme-common';
import clsx from 'clsx';
import styles from './styles.module.css';
import isInternalUrl from '@docusaurus/isInternalUrl';
import {translate} from '@docusaurus/Translate';
function CardContainer({href, children}) {
return (
<Link
href={href}
className={clsx('card padding--lg', styles.cardContainer)}>
{children}
</Link>
);
}
function CardLayout({href, icon, title, description}) {
return (
<CardContainer href={href}>
<h2 className={clsx('text--truncate', styles.cardTitle)} title={title}>
{icon} {title}
</h2>
{description && (
<p
className={clsx('text--truncate', styles.cardDescription)}
title={description}>
{description}
</p>
)}
</CardContainer>
);
}
function CardCategory({item}) {
const href = findFirstCategoryLink(item); // Unexpected: categories that don't have a link have been filtered upfront
if (!href) {
return null;
}
return (
<CardLayout
href={href}
icon=""
title={item.label}
description={translate(
{
message: '{count} items',
id: 'theme.docs.DocCard.categoryDescription',
description:
'The default description for a category card in the generated index about how many items this category includes',
},
{
count: item.items.length,
},
)}
/>
);
}
function CardLink({item}) {
const doc = useDocById(item.docId ?? undefined);
const icon = "";
return (
<CardLayout
href={item.href}
icon={icon}
title={item.label}
description={doc?.description}
/>
);
}
export default function DocCard({item}) {
switch (item.type) {
case 'link':
return <CardLink item={item} />;
case 'category':
return <CardCategory item={item} />;
default:
throw new Error(`unknown item type ${JSON.stringify(item)}`);
}
}

View File

@@ -0,0 +1,27 @@
.cardContainer {
--ifm-link-color: var(--ifm-color-emphasis-800);
--ifm-link-hover-color: var(--ifm-color-emphasis-700);
--ifm-link-hover-decoration: none;
box-shadow: 0 1.5px 3px 0 rgb(0 0 0 / 15%);
border: 1px solid var(--ifm-color-emphasis-200);
transition: all var(--ifm-transition-fast) ease;
transition-property: border, box-shadow;
}
.cardContainer:hover {
border-color: var(--ifm-color-primary);
box-shadow: 0 3px 6px 0 rgb(0 0 0 / 20%);
}
.cardContainer *:last-child {
margin-bottom: 0;
}
.cardTitle {
font-size: 1.2rem;
}
.cardDescription {
font-size: 0.8rem;
}