refactor(v2): remove page plugin component

This commit is contained in:
Yangshun Tay 2019-05-05 12:33:54 -07:00
parent 1827c6f333
commit 637047af2c
4 changed files with 12 additions and 27 deletions

View file

@ -13,7 +13,6 @@ const DEFAULT_OPTIONS = {
path: 'pages', // Path to data on filesystem, relative to site dir. path: 'pages', // Path to data on filesystem, relative to site dir.
routeBasePath: '', // URL Route. routeBasePath: '', // URL Route.
include: ['**/*.{js,jsx}'], // Extensions to include. include: ['**/*.{js,jsx}'], // Extensions to include.
component: '@theme/Page',
}; };
class DocusaurusPluginContentPages { class DocusaurusPluginContentPages {
@ -65,7 +64,6 @@ class DocusaurusPluginContentPages {
} }
async contentLoaded({content, actions}) { async contentLoaded({content, actions}) {
const {component} = this.options;
const {addRoute, createData} = actions; const {addRoute, createData} = actions;
await Promise.all( await Promise.all(
@ -77,10 +75,9 @@ class DocusaurusPluginContentPages {
); );
addRoute({ addRoute({
path: permalink, path: permalink,
component, component: source,
exact: true, exact: true,
modules: { modules: {
content: source,
metadata: metadataPath, metadata: metadataPath,
}, },
}); });

View file

@ -1,20 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import Layout from '@theme/Layout'; // eslint-disable-line
function Page(props) {
const {content: PageContent} = props;
return (
<Layout>
<PageContent />
</Layout>
);
}
export default Page;

View file

@ -6,6 +6,8 @@
*/ */
import React, {useEffect} from 'react'; import React, {useEffect} from 'react';
import Layout from '@theme/Layout';
import canny from '../../scripts/canny'; import canny from '../../scripts/canny';
const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91'; const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91';
@ -20,7 +22,11 @@ function Feedback() {
}); });
}, []); }, []);
return <div className="container margin-vert--xl" data-canny />; return (
<Layout>
<div className="container margin-vert--xl" data-canny />
</Layout>
);
} }
export default Feedback; export default Feedback;

View file

@ -10,6 +10,8 @@ import Head from '@docusaurus/Head';
import DocusaurusContext from '@docusaurus/context'; import DocusaurusContext from '@docusaurus/context';
import Link from '@docusaurus/Link'; import Link from '@docusaurus/Link';
import Layout from '@theme/Layout';
import classnames from 'classnames'; import classnames from 'classnames';
import styles from './styles.module.css'; import styles from './styles.module.css';
@ -73,7 +75,7 @@ function Home() {
}, []); }, []);
return ( return (
<div> <Layout>
<div className={styles['index-hero']}> <div className={styles['index-hero']}>
<div className={styles['index-hero-inner']}> <div className={styles['index-hero-inner']}>
<h1 className={styles['index-hero-project-tagline']}> <h1 className={styles['index-hero-project-tagline']}>
@ -214,7 +216,7 @@ function Home() {
</div> </div>
</div> </div>
</div> </div>
</div> </Layout>
); );
} }