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

chore: add homepages for each learn, build and user #94

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions docs/learn/learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package learn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Havent figured out a way of adding a docsId to the pages/learn yet. Tried inserting some react but this is a bit of a hacky workaround for now to ensure the versioning works.

102 changes: 94 additions & 8 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

const lastVersion = "0.50";

const lastVersion = "v0.50";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated all of these so they are consistent

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down Expand Up @@ -44,12 +45,13 @@ const config = {
current: {
path: "main",
banner: "unreleased",
label: "Main",
},
"0.50": {
"v0.50": {
path: "v0.50",
label: "v0.50",
},
0.47: {
"v0.47": {
path: "v0.47",
label: "v0.47",
},
Expand Down Expand Up @@ -83,9 +85,11 @@ const config = {
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
image: "img/banner.jpg",
exclude: "docs/learn/learn.md",
docs: {
sidebar: {
autoCollapseCategories: true,

},
},
navbar: {
Expand All @@ -98,33 +102,115 @@ const config = {
target: "_self",
},
items: [
{
type: "doc",
{
type: "dropdown",
label: "Learn",
docId: "learn/intro/overview",
position: "left",
items: [
{
type: "doc",
label: "Home",
docId: "learn/learn",
},
{
type: "doc",
label: "Introduction",
docId: "learn/intro/overview",
},
{
type: "doc",
label: "Beginner",
docId: "learn/beginner/app-anatomy",
},
{
type: "doc",
label: "Advanced",
docId: "learn/advanced/baseapp",
},
]
},
{
type: 'dropdown',
label: 'Build',
position: 'left',
items: [
{
type: "doc",
label: "Home",
docId: "build/build",
},
{
type: "doc",
label: "Build Apps",
docId: "build/building-apps/app-go",
},
{
type: "doc",
label: "Build a Module",
docId: "build/building-modules/intro",
},
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats the thought behind doing a dropdown for everything?

type: "doc",
label: "Migrations",
docId: "build/migrations/intro",
},
{
type: "doc",
label: "Packages",
docId: "build/packages/README",
},
{
type: "doc",
label: "Tooling",
docId: "build/tooling/README",
},
{
type: "doc",
label: "ADR's",
docId: "build/architecture/README",
},
{
type: "doc",
label: "RFC",
docId: "build/rfc/README",
},
{
type: "doc",
label: "Specifications",
docId: "build/spec/README",
},
{
label: "Cosmos SDK API",
to: "api",
},
],
},
{
type: "doc",
type: "dropdown",
label: "User Guides",
docId: "user/run-node/keyring", // I find it weird that it points to the keyring and not a common page
position: "left",
items: [
{
type: "doc",
label: "Home",
docId: "user/user",
},
{
type: "doc",
label: "Setting up Keys",
docId: "user/run-node/keyring",
},
{
type: "doc",
label: "Running a Node",
docId: "user/run-node/run-node",
},
{
type: "doc",
label: "CLI",
docId: "user/run-node/interact-node",
},
]
},
{
href: "https://github.com/cosmos/cosmos-sdk",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"typecheck": "tsc"
},
"dependencies": {
"@cmfcmf/docusaurus-search-local": "^1.1.0",
"@docusaurus/core": "2.4.0",
"@docusaurus/plugin-client-redirects": "^2.4.0",
"@docusaurus/plugin-content-docs": "^2.4.0",
Expand All @@ -25,7 +26,7 @@
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"redocusaurus": "^1.6.4"
"redocusaurus": "^1.6.4",
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.0",
Expand Down
149 changes: 146 additions & 3 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,152 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
learnSidebar: [{ type: "autogenerated", dirName: "learn" }],
buildSidebar: [{ type: "autogenerated", dirName: "build" }],
userSidebar: [{ type: "autogenerated", dirName: "user" }],
"learnSidebar": [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these had to be changed to ensure that the learn/learn page above (where i commented about the versioning) is not possible to get to

{
"type": "category",
"label": "Introduction",
"items": [
{
"type": "autogenerated",
"dirName": "learn/intro"
}
]
},
{
"type": "category",
"label": "Beginner",
"items": [
{
"type": "autogenerated",
"dirName": "learn/beginner"
}
]
},
{
"type": "category",
"label": "Advanced",
"items": [
{
"type": "autogenerated",
"dirName": "learn/advanced"
}
]
}
],
"buildSidebar": [
{
"type": "category",
"label": "Building Apps",
"items": [
{
"type": "autogenerated",
"dirName": "build/building-apps"
}
]
},
{
"type": "category",
"label": "Building Modules",
"items": [
{
"type": "autogenerated",
"dirName": "build/building-modules"
}
]
},
{
"type": "category",
"label": "Modules",
"items": [
{
"type": "autogenerated",
"dirName": "build/modules"
}
]
},
{
"type": "category",
"label": "Migrations",
"items": [
{
"type": "autogenerated",
"dirName": "build/migrations"
}
]
},
{
"type": "category",
"label": "Packages",
"items": [
{
"type": "autogenerated",
"dirName": "build/packages"
}
]
},
{
"type": "category",
"label": "Tooling",
"items": [
{
"type": "autogenerated",
"dirName": "build/tooling"
}
]
},
{
"type": "category",
"label": "ADR's",
"items": [
{
"type": "autogenerated",
"dirName": "build/architecture"
}
]
},
{
"type": "category",
"label": "Migrations",
"items": [
{
"type": "autogenerated",
"dirName": "build/migrations"
}
]
},
{
"type": "category",
"label": "RFC's",
"items": [
{
"type": "autogenerated",
"dirName": "build/rfc"
}
]
},
{
"type": "category",
"label": "Specifications",
"items": [
{
"type": "autogenerated",
"dirName": "build/spec"
}
]
}
],
"userSidebar": [
{
"type": "category",
"label": "Running a Node, API and CLI",
"items": [
{
"type": "autogenerated",
"dirName": "user/run-node"
}
]
}
]
};

module.exports = sidebars;
40 changes: 40 additions & 0 deletions src/components/HomepageFeatures/main/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from "react";
import clsx from "clsx";
import styles from "./styles.module.css";
import Link from "@docusaurus/Link";



function Feature({Svg, to, title, description }) {
return (
<div className="col col--4">
<div className={styles.bg}>
<Link to={to}>
<div className=" text--center">
<Svg className={styles.featureSvg} role="img" />
</div>
</Link>
<div className="text--center padding-horiz--md">
<h3 className="py-5">
<strong>{title}</strong>
</h3>
<p className="pb-10">{description}</p>
</div>
</div>
</div>
);
}

export default function HomepageFeatures({list}) {
return (
<section className={styles.features}>
<div className="container pt-9">
<div className="row">
{list.map((props, idx) => (
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
);
}
Loading
Loading