@defra/docusaurus-theme-govuk 0.0.1-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +163 -0
  3. package/index.js +215 -0
  4. package/package.json +44 -0
  5. package/src/css/components.scss +90 -0
  6. package/src/css/doc-overrides.css +19 -0
  7. package/src/css/prose-scope.scss +59 -0
  8. package/src/css/theme.scss +18 -0
  9. package/src/lib/empty-module.js +2 -0
  10. package/src/lib/react-foundry-router-shim.js +68 -0
  11. package/src/theme/Admonition/index.js +33 -0
  12. package/src/theme/AnnouncementBar/index.js +5 -0
  13. package/src/theme/CodeBlock/index.js +55 -0
  14. package/src/theme/DocItem/Content/index.js +28 -0
  15. package/src/theme/DocItem/Footer/index.js +5 -0
  16. package/src/theme/DocItem/Layout/index.js +10 -0
  17. package/src/theme/DocItem/Metadata/index.js +17 -0
  18. package/src/theme/DocItem/Paginator/index.js +36 -0
  19. package/src/theme/DocItem/TOC/Desktop/index.js +5 -0
  20. package/src/theme/DocItem/TOC/Mobile/index.js +5 -0
  21. package/src/theme/DocItem/docContext.js +37 -0
  22. package/src/theme/DocItem/index.js +22 -0
  23. package/src/theme/DocPage/Layout/index.js +5 -0
  24. package/src/theme/DocRoot/Layout/index.js +10 -0
  25. package/src/theme/DocRoot/index.js +18 -0
  26. package/src/theme/DocVersionRoot/index.js +6 -0
  27. package/src/theme/DocsRoot/index.js +6 -0
  28. package/src/theme/Heading/index.js +29 -0
  29. package/src/theme/Homepage/index.js +47 -0
  30. package/src/theme/Layout/Provider/index.js +5 -0
  31. package/src/theme/Layout/index.js +181 -0
  32. package/src/theme/MDXComponents/index.js +42 -0
  33. package/src/theme/MDXContent/index.js +7 -0
  34. package/src/theme/NotFound/Content/index.js +23 -0
  35. package/src/theme/NotFound/index.js +11 -0
  36. package/src/theme/Root/index.js +5 -0
  37. package/src/theme/TOCItems/index.js +5 -0
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import CodeBlock from '@theme/CodeBlock';
3
+ import Heading from '@theme/Heading';
4
+ import Admonition from '@theme/Admonition';
5
+ import {InsetText} from '@not-govuk/simple-components';
6
+
7
+ function GovukLink(props) {
8
+ return <a className="govuk-link" {...props} />;
9
+ }
10
+
11
+ const MDXComponents = {
12
+ // Inline code only; block code is handled by the pre handler
13
+ code: (props) => <code {...props} />,
14
+ pre: (props) => {
15
+ // MDX wraps fenced code blocks in <pre><code className="language-x">.
16
+ // Extract the inner code element props and render as CodeBlock.
17
+ const {children} = props;
18
+ if (React.isValidElement(children)) {
19
+ return <CodeBlock {...children.props} />;
20
+ }
21
+ return <pre {...props} />;
22
+ },
23
+ // GOV.UK table styling
24
+ table: (props) => <table className="govuk-table" {...props} />,
25
+ thead: (props) => <thead className="govuk-table__head" {...props} />,
26
+ tbody: (props) => <tbody className="govuk-table__body" {...props} />,
27
+ tr: (props) => <tr className="govuk-table__row" {...props} />,
28
+ th: (props) => <th className="govuk-table__header" {...props} />,
29
+ td: (props) => <td className="govuk-table__cell" {...props} />,
30
+ // Blockquotes rendered as GOV.UK InsetText
31
+ blockquote: ({children, ...rest}) => <InsetText {...rest}>{children}</InsetText>,
32
+ h1: (props) => <Heading as="h1" {...props} />,
33
+ h2: (props) => <Heading as="h2" {...props} />,
34
+ h3: (props) => <Heading as="h3" {...props} />,
35
+ h4: (props) => <Heading as="h4" {...props} />,
36
+ h5: (props) => <Heading as="h5" {...props} />,
37
+ h6: (props) => <Heading as="h6" {...props} />,
38
+ a: GovukLink,
39
+ admonition: Admonition,
40
+ };
41
+
42
+ export default MDXComponents;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import {MDXProvider} from '@mdx-js/react';
3
+ import MDXComponents from '@theme/MDXComponents';
4
+
5
+ export default function MDXContent({children}) {
6
+ return <MDXProvider components={MDXComponents}>{children}</MDXProvider>;
7
+ }
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import useBaseUrl from '@docusaurus/useBaseUrl';
3
+
4
+ export default function NotFoundContent() {
5
+ const homeUrl = useBaseUrl('/');
6
+
7
+ return (
8
+ <div className="app-prose-scope">
9
+ <h1 className="govuk-heading-xl">Page not found</h1>
10
+ <p className="govuk-body">
11
+ If you typed the web address, check it is correct.
12
+ </p>
13
+ <p className="govuk-body">
14
+ If you pasted the web address, check you copied the entire address.
15
+ </p>
16
+ <p className="govuk-body">
17
+ <a href={homeUrl} className="govuk-link">
18
+ Go to the homepage
19
+ </a>
20
+ </p>
21
+ </div>
22
+ );
23
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import Layout from '@theme/Layout';
3
+ import NotFoundContent from '@theme/NotFound/Content';
4
+
5
+ export default function NotFound() {
6
+ return (
7
+ <Layout title="Page not found">
8
+ <NotFoundContent />
9
+ </Layout>
10
+ );
11
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+
3
+ export default function Root({children}) {
4
+ return <>{children}</>;
5
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+
3
+ export default function TOCItems() {
4
+ return null;
5
+ }