mirror of
https://gitea.com/gitea/docs.git
synced 2026-09-18 03:58:52 +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 <[email protected]> Co-authored-by: techknowlogick <[email protected]> Reviewed-on: https://gitea.com/gitea/gitea-docusaurus/pulls/47 Co-authored-by: HesterG <[email protected]> Co-committed-by: HesterG <[email protected]>
This commit is contained in:
committed by
Lunny Xiao
co-authored by
techknowlogick
techknowlogick
parent
c77d0e0e34
commit
02b0ebc9e1
@@ -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;
|
||||
@@ -0,0 +1,2 @@
|
||||
import ApiDoc from './ApiDoc';
|
||||
export default ApiDoc;
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
.docPage {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.docsWrapper {
|
||||
display: flex;
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
Reference in New Issue
Block a user