mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +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
37
website/src/featureRequests/FeatureRequestsPage.tsx
Normal file
37
website/src/featureRequests/FeatureRequestsPage.tsx
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* 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, {useEffect} from 'react';
|
||||
import Layout from '@theme/Layout';
|
||||
|
||||
import cannyScript from './cannyScript';
|
||||
import clsx from 'clsx';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
const BOARD_TOKEN = '054e0e53-d951-b14c-7e74-9eb8f9ed2f91';
|
||||
|
||||
function FeatureRequests() {
|
||||
useEffect(() => {
|
||||
cannyScript();
|
||||
const Canny = (window as any).Canny;
|
||||
Canny('render', {
|
||||
boardToken: BOARD_TOKEN,
|
||||
basePath: '/feature-requests',
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Layout title="Feedback" description="Docusaurus 2 Feature Requests page">
|
||||
<main
|
||||
className={clsx('container', 'margin-vert--lg', styles.main)}
|
||||
data-canny
|
||||
/>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
37
website/src/featureRequests/cannyScript.js
Normal file
37
website/src/featureRequests/cannyScript.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Provided by Canny.
|
||||
|
||||
function cannyScript() {
|
||||
!(function (w, d, i, s) {
|
||||
function l() {
|
||||
if (!d.getElementById(i)) {
|
||||
let f = d.getElementsByTagName(s)[0],
|
||||
e = d.createElement(s);
|
||||
(e.type = 'text/javascript'),
|
||||
(e.async = !0),
|
||||
(e.src = 'https://canny.io/sdk.js'),
|
||||
f.parentNode.insertBefore(e, f);
|
||||
}
|
||||
}
|
||||
if (typeof w.Canny !== 'function') {
|
||||
var c = function () {
|
||||
c.q.push(arguments);
|
||||
};
|
||||
(c.q = []),
|
||||
(w.Canny = c),
|
||||
d.readyState === 'complete'
|
||||
? l()
|
||||
: w.attachEvent
|
||||
? w.attachEvent('onload', l)
|
||||
: w.addEventListener('load', l, !1);
|
||||
}
|
||||
})(window, document, 'canny-jssdk', 'script');
|
||||
}
|
||||
|
||||
export default cannyScript;
|
13
website/src/featureRequests/styles.module.css
Normal file
13
website/src/featureRequests/styles.module.css
Normal file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
.main {
|
||||
padding: var(--ifm-spacing-horizontal);
|
||||
border-radius: 4px;
|
||||
background: var(--ifm-color-feedback-background);
|
||||
min-height: 500px;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue