Skip to content
This repository was archived by the owner on Jun 29, 2023. It is now read-only.

Change registry menu to horizontal #195

Merged
merged 5 commits into from
Jan 20, 2020
Merged
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
39 changes: 16 additions & 23 deletions src/page/Registry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Box } from "@material-ui/core";
import { Box, ButtonGroup, Button } from "@material-ui/core";
import { useLocation } from "react-router-dom";
import Link from "../component/Link.tsx";
import Spinner from "../component/Spinner";
Expand All @@ -19,7 +19,6 @@ export default function Registry() {
});
const { pathname, search, hash } = useLocation();
const firstSelectedLine = React.useRef(null);

React.useEffect(() => {
setIsLoading(true);
const { entry, path } = proxy(pathname);
Expand Down Expand Up @@ -106,27 +105,21 @@ export default function Registry() {
const isDocsPage = search.includes("doc") && state.contents;
contentComponent = (
<div>
{isDocsPage ? (
<p>
<Link to="?">Source Code</Link>
</p>
) : hasDocsAvailable ? (
<p>
<Link color="primary" to="?doc">
Documentation
</Link>
</p>
) : null}
{state.repoUrl ? (
<p>
<Link to={state.repoUrl}>Repository</Link>
</p>
) : null}
{state.rawUrl ? (
<p>
<Link to={state.rawUrl}>Raw</Link>
</p>
) : null}
<ButtonGroup
size="small"
variant="text"
color="primary"
>
{isDocsPage ? (
<Button href="?">Source Code</Button>
) : hasDocsAvailable ? (
<Button href="?doc">Documentation</Button>
) : null}
{state.repoUrl ? (
<Button href={state.repoUrl}>Repository</Button>
) : null}
{state.rawUrl ? <Button href={state.rawUrl}>Raw</Button> : null}
</ButtonGroup>
{(() => {
if (isMarkdown) {
return <Markdown source={state.contents} />;
Expand Down