doc.silverstripe.org/src/templates/docs-template.tsx
Aaron Carlino 8ffc3eeb5b
WIP: Add userhelp to new site (#216)
* 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
2019-12-19 11:54:23 +13:00

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
}
}
}
}
}
}
}
`
;