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:
Sébastien Lorber 2021-08-20 11:42:13 +02:00 committed by GitHub
parent 974644d16b
commit f40ce05102
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 95 additions and 66 deletions

View 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;

View 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;

View 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;

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