mirror of
https://gitea.com/gitea/docs.git
synced 2026-06-27 14:44:23 +00:00
Add subscription and community components (#47)
Close #46 Same as those in [blog](https://gitea.com/gitea/blog/pulls/272), but for docs and api Ejected DocPage (unsafe to eject) and ApiDoc (safe to eject) for layout changes  Screenshots  Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/47 Co-authored-by: HesterG <hestergong@gmail.com> Co-committed-by: HesterG <hestergong@gmail.com>
This commit is contained in:
16
src/theme/ApiDoc/ApiDoc.jsx
Normal file
16
src/theme/ApiDoc/ApiDoc.jsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import React from 'react';
|
||||
import Layout from '@theme/Layout';
|
||||
import Redoc from '@theme/Redoc';
|
||||
import { ActionFooter } from "@site/src/components/ActionFooter";
|
||||
import { Section } from "@site/src/components/Section";
|
||||
function ApiDoc({ layoutProps, specProps }) {
|
||||
const defaultTitle = specProps.spec?.info?.title || 'API Docs';
|
||||
const defaultDescription = specProps.spec?.info?.description || 'Open API Reference Docs for the API';
|
||||
return (<Layout title={defaultTitle} description={defaultDescription} {...layoutProps}>
|
||||
<Redoc {...specProps}/>
|
||||
<Section>
|
||||
<ActionFooter />
|
||||
</Section>
|
||||
</Layout>);
|
||||
}
|
||||
export default ApiDoc;
|
||||
2
src/theme/ApiDoc/index.js
Normal file
2
src/theme/ApiDoc/index.js
Normal file
@@ -0,0 +1,2 @@
|
||||
import ApiDoc from './ApiDoc';
|
||||
export default ApiDoc;
|
||||
36
src/theme/DocPage/Layout/index.js
Normal file
36
src/theme/DocPage/Layout/index.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// Ejected unsafe, need to check if this changes and maintain this component
|
||||
// https://github.com/facebook/docusaurus/blob/docusaurus-v2/packages/docusaurus-theme-classic/src/theme/DocPage/Layout/index.tsx
|
||||
import React, {useState} from 'react';
|
||||
import {useDocsSidebar} from '@docusaurus/theme-common/internal';
|
||||
import Layout from '@theme/Layout';
|
||||
import BackToTopButton from '@theme/BackToTopButton';
|
||||
import DocPageLayoutSidebar from '@theme/DocPage/Layout/Sidebar';
|
||||
import DocPageLayoutMain from '@theme/DocPage/Layout/Main';
|
||||
import styles from './styles.module.css';
|
||||
import { ActionFooter } from "@site/src/components/ActionFooter";
|
||||
import { Section } from "@site/src/components/Section";
|
||||
|
||||
export default function DocPageLayout({children}) {
|
||||
const sidebar = useDocsSidebar();
|
||||
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
||||
return (
|
||||
<Layout wrapperClassName={styles.docsWrapper}>
|
||||
<BackToTopButton />
|
||||
<div className={styles.docPage}>
|
||||
{sidebar && (
|
||||
<DocPageLayoutSidebar
|
||||
sidebar={sidebar.items}
|
||||
hiddenSidebarContainer={hiddenSidebarContainer}
|
||||
setHiddenSidebarContainer={setHiddenSidebarContainer}
|
||||
/>
|
||||
)}
|
||||
<DocPageLayoutMain hiddenSidebarContainer={hiddenSidebarContainer}>
|
||||
{children}
|
||||
</DocPageLayoutMain>
|
||||
</div>
|
||||
<Section>
|
||||
<ActionFooter />
|
||||
</Section>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
9
src/theme/DocPage/Layout/styles.module.css
Normal file
9
src/theme/DocPage/Layout/styles.module.css
Normal file
@@ -0,0 +1,9 @@
|
||||
.docPage {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.docsWrapper {
|
||||
display: flex;
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
Reference in New Issue
Block a user