mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-06-28 15:39:44 +02:00
8ffc3eeb5b
* Docs/userguide switching * Initial commit of userdocs merge * Remove service worker, fix rendering * Remove limited sources * UX improvements per Paul design * Tweak version select for FF * Fix mobile view * Final tweaks to UI * Tweaks to search bar, clean up conflicts * Fix icons * Hide search if no API key
53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
import React, { StatelessComponent, ReactElement } from 'react';
|
|
import { graphql } from 'gatsby';
|
|
import DocsPage from '../components/DocsPage';
|
|
import { SingleFileQuery } from '../types';
|
|
|
|
const Template: StatelessComponent<SingleFileQuery> = (result): ReactElement => {
|
|
const currentNode = result.data.silverstripeDocument;
|
|
const { title } = currentNode;
|
|
const { html } = currentNode.watchFile;
|
|
const { relativePath, gitRemote } = currentNode.parent.parent;
|
|
const { ref, href } = gitRemote;
|
|
|
|
return (
|
|
<DocsPage
|
|
title={title}
|
|
html={html}
|
|
relPath={relativePath}
|
|
branch={ref}
|
|
gitURL={href}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default Template;
|
|
|
|
export const pageQuery = graphql`
|
|
query DocsBySlug($slug: String!) {
|
|
silverstripeDocument(slug: { eq: $slug }) {
|
|
title
|
|
slug
|
|
id
|
|
watchFile {
|
|
html
|
|
}
|
|
parent {
|
|
... on MarkdownRemark {
|
|
html
|
|
parent {
|
|
... on File {
|
|
relativePath
|
|
gitRemote {
|
|
href
|
|
ref
|
|
sourceInstanceName
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
; |