Skip to content

Commit fc96bfc

Browse files
Flatten the development hierarchy
This makes the content more immediately accessible and easier to browse through. Styling has also been adjusted as necessary to accomodate a flatter hierarchy of items; presenting content as a list with headers instead of a grid of cards.
1 parent 825ccb1 commit fc96bfc

File tree

9 files changed

+142
-124
lines changed

9 files changed

+142
-124
lines changed

config/sidebar.paper.ts

+43-56
Original file line numberDiff line numberDiff line change
@@ -89,75 +89,62 @@ const paper: SidebarsConfig = {
8989
},
9090
items: [
9191
{
92-
type: "category",
93-
label: "Getting started",
94-
collapsed: true,
95-
link: {
96-
type: "doc",
97-
id: "dev/getting-started/README",
98-
},
99-
items: [
100-
"dev/getting-started/project-setup",
101-
"dev/getting-started/plugin-yml",
102-
"dev/getting-started/how-do-plugins-work",
103-
"dev/getting-started/paper-plugins",
104-
"dev/getting-started/userdev",
105-
],
92+
type: "html",
93+
value: "Getting Started",
94+
className: "sidebarTitle",
95+
defaultStyle: true,
96+
},
97+
"dev/getting-started/project-setup",
98+
"dev/getting-started/plugin-yml",
99+
"dev/getting-started/how-do-plugins-work",
100+
"dev/getting-started/paper-plugins",
101+
"dev/getting-started/userdev",
102+
{
103+
type: "html",
104+
value: "Plugin API",
105+
className: "sidebarTitle",
106+
defaultStyle: true,
106107
},
107108
{
108109
type: "category",
109-
label: "API",
110+
label: "Event API",
111+
description: "Respond to and modify in-game actions",
110112
collapsed: true,
111-
link: {
112-
type: "doc",
113-
id: "dev/api/README",
114-
},
115113
items: [
116-
{
117-
type: "category",
118-
label: "Event API",
119-
collapsed: true,
120-
items: [
121-
"dev/api/event-api/event-listeners",
122-
"dev/api/event-api/custom-events",
123-
"dev/api/event-api/handler-lists",
124-
"dev/api/event-api/chat-event",
125-
],
126-
},
127-
{
128-
type: "category",
129-
label: "Component API (Adventure)",
130-
collapsed: true,
131-
items: [
132-
"dev/api/component-api/intro",
133-
"dev/api/component-api/i18n",
134-
"dev/api/component-api/audiences",
135-
],
136-
},
137-
"dev/api/pdc",
138-
"dev/api/custom-inventory-holder",
139-
"dev/api/scheduler",
140-
"dev/api/plugin-messaging",
141-
"dev/api/plugin-configs",
142-
"dev/api/folia-support",
143-
"dev/api/roadmap",
114+
"dev/api/event-api/event-listeners",
115+
"dev/api/event-api/custom-events",
116+
"dev/api/event-api/handler-lists",
117+
"dev/api/event-api/chat-event",
144118
],
145119
},
146120
{
147121
type: "category",
148-
label: "Miscellaneous",
122+
label: "Component API (Adventure)",
123+
description: "Work with Minecraft's chat components",
149124
collapsed: true,
150-
link: {
151-
type: "doc",
152-
id: "dev/misc/README",
153-
},
154125
items: [
155-
"dev/misc/reading-stacktraces",
156-
"dev/misc/debugging",
157-
"dev/misc/databases",
158-
"dev/misc/internal-code",
126+
"dev/api/component-api/intro",
127+
"dev/api/component-api/i18n",
128+
"dev/api/component-api/audiences",
159129
],
160130
},
131+
"dev/api/pdc",
132+
"dev/api/custom-inventory-holder",
133+
"dev/api/scheduler",
134+
"dev/api/plugin-messaging",
135+
"dev/api/plugin-configs",
136+
"dev/api/folia-support",
137+
"dev/api/roadmap",
138+
{
139+
type: "html",
140+
value: "Miscellaneous",
141+
className: "sidebarTitle",
142+
defaultStyle: true,
143+
},
144+
"dev/misc/reading-stacktraces",
145+
"dev/misc/debugging",
146+
"dev/misc/databases",
147+
"dev/misc/internal-code",
161148
],
162149
},
163150
{

docs/paper/dev/README.mdx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import DocCardList from "@theme/DocCardList";
22
import { useCurrentSidebarCategory } from "@docusaurus/theme-common";
33

4-
# Development Guide
4+
# Paper Development
55

6-
Welcome to the Paper development guide! This guide includes information and tutorials for developers
7-
on how to create and expand on Paper plugins.
6+
Create plugins with the Paper API in order to extend Minecraft with custom and modified behavior.
87

98
---
109

docs/paper/dev/api/README.mdx

-11
This file was deleted.

docs/paper/dev/getting-started/README.mdx

-11
This file was deleted.

docs/paper/dev/misc/README.mdx

-10
This file was deleted.

src/css/custom.css

+30
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,31 @@ html[data-theme="dark"] {
4040
--eol-message-background-color: rgb(92, 15, 18);
4141
}
4242

43+
.theme-doc-sidebar-item-link > a::before,
44+
.theme-doc-sidebar-item-category > div > a::before {
45+
margin-right: 0.3rem;
46+
height: 24px;
47+
width: 24px;
48+
}
49+
50+
.theme-doc-sidebar-item-link > a::before {
51+
content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0iYmxhY2siIGQ9Ik0xNCAySDZhMiAyIDAgMCAwLTIgMnYxNmEyIDIgMCAwIDAgMiAyaDEyYTIgMiAwIDAgMCAyLTJWOHptNCAxOEg2VjRoN3Y1aDV6Ii8+PC9zdmc+);
52+
}
53+
54+
.theme-doc-sidebar-item-category > div > a::before {
55+
content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0iYmxhY2siIGQ9Ik03IDVoMTR2Mkg3em0wIDh2LTJoMTR2MnpNNCA0LjVBMS41IDEuNSAwIDAgMSA1LjUgNkExLjUgMS41IDAgMCAxIDQgNy41QTEuNSAxLjUgMCAwIDEgMi41IDZBMS41IDEuNSAwIDAgMSA0IDQuNW0wIDZBMS41IDEuNSAwIDAgMSA1LjUgMTJBMS41IDEuNSAwIDAgMSA0IDEzLjVBMS41IDEuNSAwIDAgMSAyLjUgMTJBMS41IDEuNSAwIDAgMSA0IDEwLjVNNyAxOXYtMmgxNHYyem0tMy0yLjVBMS41IDEuNSAwIDAgMSA1LjUgMThBMS41IDEuNSAwIDAgMSA0IDE5LjVBMS41IDEuNSAwIDAgMSAyLjUgMThBMS41IDEuNSAwIDAgMSA0IDE2LjUiLz48L3N2Zz4=);
56+
}
57+
58+
@media (prefers-color-scheme: dark) {
59+
.theme-doc-sidebar-item-link > a::before {
60+
content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0xNCAySDZhMiAyIDAgMCAwLTIgMnYxNmEyIDIgMCAwIDAgMiAyaDEyYTIgMiAwIDAgMCAyLTJWOHptNCAxOEg2VjRoN3Y1aDV6Ii8+PC9zdmc+);
61+
}
62+
63+
.theme-doc-sidebar-item-category > div > a::before {
64+
content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik03IDVoMTR2Mkg3em0wIDh2LTJoMTR2MnpNNCA0LjVBMS41IDEuNSAwIDAgMSA1LjUgNkExLjUgMS41IDAgMCAxIDQgNy41QTEuNSAxLjUgMCAwIDEgMi41IDZBMS41IDEuNSAwIDAgMSA0IDQuNW0wIDZBMS41IDEuNSAwIDAgMSA1LjUgMTJBMS41IDEuNSAwIDAgMSA0IDEzLjVBMS41IDEuNSAwIDAgMSAyLjUgMTJBMS41IDEuNSAwIDAgMSA0IDEwLjVNNyAxOXYtMmgxNHYyem0tMy0yLjVBMS41IDEuNSAwIDAgMSA1LjUgMThBMS41IDEuNSAwIDAgMSA0IDE5LjVBMS41IDEuNSAwIDAgMSAyLjUgMThBMS41IDEuNSAwIDAgMSA0IDE2LjUiLz48L3N2Zz4=);
65+
}
66+
}
67+
4368
.eol-message {
4469
width: 100%;
4570
min-height: 5rem;
@@ -58,6 +83,11 @@ html[data-theme="dark"] {
5883
margin: 0;
5984
}
6085

86+
.sidebarTitle {
87+
font-size: 0.8rem;
88+
font-weight: bold;
89+
}
90+
6191
.button.button--secondary {
6292
color: #f6f7f8;
6393
}

src/theme/DocCard/index.tsx

+31-22
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,15 @@ import { translate } from "@docusaurus/Translate";
77

88
import type { Props } from "@theme/DocCard";
99
import Heading from "@theme/Heading";
10-
import type { PropSidebarItemCategory, PropSidebarItemLink } from "@docusaurus/plugin-content-docs";
10+
import type {
11+
PropSidebarItemCategory,
12+
PropSidebarItemHtml,
13+
PropSidebarItemLink,
14+
} from "@docusaurus/plugin-content-docs";
1115

1216
import styles from "./styles.module.css";
1317
import { Icon } from "@iconify/react";
1418

15-
function CardContainer({ href, children }: { href: string; children: ReactNode }): JSX.Element {
16-
return (
17-
<Link href={href} className={clsx("card padding--lg", styles.cardContainer)}>
18-
{children}
19-
</Link>
20-
);
21-
}
22-
2319
function CardLayout({
2420
href,
2521
icon,
@@ -32,16 +28,23 @@ function CardLayout({
3228
description?: string;
3329
}): JSX.Element {
3430
return (
35-
<CardContainer href={href}>
36-
<Heading as="h2" className={clsx("text--truncate", styles.cardTitle)} title={title}>
37-
{icon} {title}
38-
</Heading>
39-
{description && (
40-
<p className={clsx("text--truncate", styles.cardDescription)} title={description}>
41-
{description}
42-
</p>
43-
)}
44-
</CardContainer>
31+
<Link href={href} className={clsx("padding-horiz--md", styles.cardContainer)}>
32+
{icon}
33+
<div className={clsx("padding-left--md")}>
34+
<Heading
35+
as="h2"
36+
className={clsx("margin-bottom--sm", styles.linkBlue, styles.cardTitle)}
37+
title={title}
38+
>
39+
{title}
40+
</Heading>
41+
{description && (
42+
<p className={clsx(styles.cardDescription)} title={description}>
43+
{description}
44+
</p>
45+
)}
46+
</div>
47+
</Link>
4548
);
4649
}
4750

@@ -56,7 +59,7 @@ function CardCategory({ item }: { item: PropSidebarItemCategory }): JSX.Element
5659
return (
5760
<CardLayout
5861
href={href}
59-
icon="🗃️"
62+
icon={<Icon className={"margin-right--sm"} icon="mdi:format-list-bulleted" height={25} />}
6063
title={item.label}
6164
description={
6265
item.description ??
@@ -82,9 +85,9 @@ function CardLink({ item }: { item: EmojiPropsSidebarItemLink }): JSX.Element {
8285
const icon = item.customEmoji ? (
8386
<Icon className={"margin-right--sm"} icon={item.customEmoji} height={25} />
8487
) : isInternalUrl(item.href) ? (
85-
"📄️"
88+
<Icon className={"margin-right--sm"} icon="mdi:paper-outline" height={25} />
8689
) : (
87-
"🔗"
90+
<Icon className={"margin-right--sm"} icon="mdi:format-list-bulleted" height={25} />
8891
);
8992
const doc = useDocById(item.docId ?? undefined);
9093
return (
@@ -97,12 +100,18 @@ function CardLink({ item }: { item: EmojiPropsSidebarItemLink }): JSX.Element {
97100
);
98101
}
99102

103+
function Header({ item }: { item: PropSidebarItemHtml }): JSX.Element {
104+
return <h2>{item.value}</h2>;
105+
}
106+
100107
export default function DocCard({ item }: Props): JSX.Element {
101108
switch (item.type) {
102109
case "link":
103110
return <CardLink item={item} />;
104111
case "category":
105112
return <CardCategory item={item} />;
113+
case "html":
114+
return <Header item={item} />;
106115
default:
107116
throw new Error(`unknown item type ${JSON.stringify(item)}`);
108117
}

src/theme/DocCard/styles.module.css

+9-11
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@
33
--ifm-link-hover-color: var(--ifm-color-emphasis-700);
44
--ifm-link-hover-decoration: none;
55

6-
box-shadow: 0 1.5px 3px 0 rgb(0 0 0 / 15%);
7-
border: 1px solid var(--ifm-color-emphasis-200);
8-
transition: all var(--ifm-transition-fast) ease;
9-
transition-property: border, box-shadow;
10-
}
11-
12-
.cardContainer:hover {
13-
border-color: var(--ifm-color-primary);
14-
box-shadow: 0 3px 6px 0 rgb(0 0 0 / 20%);
6+
display: flex;
7+
flex-direction: row;
8+
align-items: center;
159
}
1610

1711
.cardContainer *:last-child {
1812
margin-bottom: 0;
1913
}
2014

2115
.cardTitle {
22-
font-size: 1.2rem;
16+
font-size: 1rem;
2317
display: flex;
2418
}
2519

2620
.cardDescription {
27-
font-size: 0.8rem;
21+
font-size: 1rem;
22+
}
23+
24+
.linkBlue {
25+
color: var(--ifm-color-primary);
2826
}

src/theme/DocCardList/index.tsx

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from "react";
2+
import clsx from "clsx";
3+
import { useCurrentSidebarCategory, filterDocCardListItems } from "@docusaurus/theme-common";
4+
import DocCard from "@theme/DocCard";
5+
import type { Props } from "@theme/DocCardList";
6+
7+
function DocCardListForCurrentSidebarCategory({ className }: Props) {
8+
const category = useCurrentSidebarCategory();
9+
return <DocCardList items={category.items} className={className} />;
10+
}
11+
12+
export default function DocCardList(props: Props): JSX.Element {
13+
const { items, className } = props;
14+
if (!items) {
15+
return <DocCardListForCurrentSidebarCategory {...props} />;
16+
}
17+
const filteredItems = filterDocCardListItems(items);
18+
return (
19+
<section>
20+
{filteredItems.map((item, index) => (
21+
<article key={index} className="margin-bottom--lg">
22+
<DocCard item={item} />
23+
</article>
24+
))}
25+
</section>
26+
);
27+
}

0 commit comments

Comments
 (0)