Skip to content

Commit

Permalink
docs: fix previous and next links in the getting started section (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
aversini authored Dec 18, 2024
1 parent 7db8ca3 commit 0b2ee5d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/api/src/getting-started/Changelogs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ import SystemChangelog from "../../../ui-system/CHANGELOG.md?raw";
<Unstyled>
<div className="mt-4" />
</Unstyled>
<Navigators leftLink="Release Tags" />
<Navigators leftLabel="Release Tags" />
</div>
2 changes: 1 addition & 1 deletion packages/api/src/getting-started/Configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ import codeBlocks from "../helpers/codeBlocks";
/>
</div>

<Navigators leftLink="Installation" rightLink="Usage" />
<Navigators leftLabel="Installation" rightLabel="Usage" />

</div>
2 changes: 1 addition & 1 deletion packages/api/src/getting-started/Installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ import tableData from "../helpers/tableData";
</small>
</p>

<Navigators leftLink="Overview" rightLink="Configuration" />
<Navigators leftLabel="Overview" rightLabel="Configuration" />

</div>
2 changes: 1 addition & 1 deletion packages/api/src/getting-started/Overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Navigators from "../helpers/Navigators";
</div>
<div className="p-4">
<blockquote>The UI Components Library provides a strong, responsive, and accessible set of foundational React components.</blockquote>
<Navigators rightLink="Installation" />
<Navigators rightLabel="Installation" />
</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/getting-started/ReleaseTags.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ import Navigators from "../helpers/Navigators";
</ul>

<div className="mt-8">
<Navigators leftLink="Usage" rightLink="Changelogs" />
<Navigators leftLabel="Usage" rightLabel="Changelogs" />
</div>

</div>
2 changes: 1 addition & 1 deletion packages/api/src/getting-started/Usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ import codeBlocks from "../helpers/codeBlocks";
<p>Hello World</p>
</Card>

<Navigators leftLink="Configuration" rightLink="Release Tags" paddingTop />
<Navigators leftLabel="Configuration" rightLabel="Release Tags" paddingTop />

</div>
15 changes: 15 additions & 0 deletions packages/api/src/helpers/Navigators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ export default ({
| "space-evenly"
| undefined = "flex-end";

/**
* If the label is provided but the link is not, we generate the link from the label,
* by replacing spaces with dashes and converting to lowercase, and adding "--docs" at the end,
* and getting-started- at the beginning.
* Example: "Release Tags" -> "getting-started-release-tags--docs"
*
* This is the default for the main "getting started" pages.
*/
if (leftLabel && !leftLink) {
leftLink = `getting-started-${leftLabel.replace(/\s+/g, "-").toLowerCase()}--docs`;
}
if (rightLabel && !rightLink) {
rightLink = `getting-started-${rightLabel.replace(/\s+/g, "-").toLowerCase()}--docs`;
}

if (leftLink && rightLink) {
mainAlign = "space-between";
} else if (leftLink) {
Expand Down

0 comments on commit 0b2ee5d

Please sign in to comment.