mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 16:29:47 +02:00
refactor: clean Canny integration + rename 'Feedback' to 'Feature Requests' + improve TS doc page (#5389)
* Better Canny integration * Add missing netlify redirects * polish * TS doc: mention it's possible to use JSDoc in config * issue templates: use /feature-requests new url
This commit is contained in:
parent
974644d16b
commit
f40ce05102
16 changed files with 95 additions and 66 deletions
|
@ -8,34 +8,30 @@
|
|||
import React, {useEffect} from 'react';
|
||||
import Layout from '@theme/Layout';
|
||||
|
||||
import canny from '../../scripts/canny';
|
||||
import cannyScript from './cannyScript';
|
||||
import clsx from 'clsx';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91';
|
||||
|
||||
function Feedback() {
|
||||
function FeatureRequests() {
|
||||
useEffect(() => {
|
||||
canny();
|
||||
(window as any).Canny &&
|
||||
(window as any).Canny('render', {
|
||||
boardToken: BOARD_TOKEN,
|
||||
basePath: '/feedback',
|
||||
});
|
||||
cannyScript();
|
||||
const Canny = (window as any).Canny;
|
||||
Canny('render', {
|
||||
boardToken: BOARD_TOKEN,
|
||||
basePath: '/feature-requests',
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Layout title="Feedback" description="Docusaurus 2 Feedback page">
|
||||
<Layout title="Feedback" description="Docusaurus 2 Feature Requests page">
|
||||
<main
|
||||
className={clsx(
|
||||
'container',
|
||||
'margin-vert--xl',
|
||||
styles.feedbackBackground,
|
||||
)}
|
||||
className={clsx('container', 'margin-vert--lg', styles.main)}
|
||||
data-canny
|
||||
/>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export default Feedback;
|
||||
export default FeatureRequests;
|
22
website/src/featureRequests/FeatureRequestsPlugin.js
Normal file
22
website/src/featureRequests/FeatureRequestsPlugin.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @type {import('@docusaurus/types').Plugin} */
|
||||
function FeatureRequestsPlugin() {
|
||||
return {
|
||||
name: 'feature-requests-plugin',
|
||||
contentLoaded({actions}) {
|
||||
actions.addRoute({
|
||||
path: '/feature-requests',
|
||||
exact: false,
|
||||
component: '@site/src/featureRequests/FeatureRequestsPage',
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = FeatureRequestsPlugin;
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// Provided by Canny.
|
||||
|
||||
function canny() {
|
||||
function cannyScript() {
|
||||
!(function (w, d, i, s) {
|
||||
function l() {
|
||||
if (!d.getElementById(i)) {
|
||||
|
@ -34,4 +34,4 @@ function canny() {
|
|||
})(window, document, 'canny-jssdk', 'script');
|
||||
}
|
||||
|
||||
export default canny;
|
||||
export default cannyScript;
|
|
@ -5,8 +5,9 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
.feedbackBackground {
|
||||
.main {
|
||||
padding: var(--ifm-spacing-horizontal);
|
||||
border-radius: 4px;
|
||||
background: var(--ifm-color-feedback-background);
|
||||
min-height: 500px;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* 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';
|
||||
import Feedback from '../pages/feedback';
|
||||
|
||||
function NotFound({location}: {location: {pathname: string}}): JSX.Element {
|
||||
if (/^\/\bfeedback\b/.test(location.pathname)) {
|
||||
return <Feedback />;
|
||||
} else {
|
||||
return (
|
||||
<Layout title="Page Not Found">
|
||||
<main className="container margin-vert--xl" data-canny>
|
||||
<div className="row">
|
||||
<div className="col col--6 col--offset-3">
|
||||
<h1 className="hero__title">Page Not Found</h1>
|
||||
<p>We could not find what you were looking for.</p>
|
||||
<p>
|
||||
Please contact the owner of the site that linked you to the
|
||||
original URL and let them know their link is broken.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default NotFound;
|
Loading…
Add table
Add a link
Reference in a new issue