[New Feature] Add web folder to support web documentation

This commit is contained in:
Rudy Haryanto
2022-10-04 20:17:17 +07:00
parent c27f624ca8
commit a54aa04c9b
251 changed files with 11079 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import React, {useState} from 'react';
const DocsRating = ({label}) => {
if (!ExecutionEnvironment.canUseDOM) {
return null;
}
const [haveVoted, setHaveVoted] = useState(false);
const giveFeedback = value => {
if (window.ga) {
window.ga('send', {
hitType: 'event',
eventCategory: 'button',
eventAction: 'feedback',
eventLabel: label,
eventValue: value,
});
}
setHaveVoted(true);
};
return (
<div className="docsRating">
{haveVoted ? (
'Thanks for letting us know!'
) : (
<>
Is this page useful?
<svg
className="i_thumbsup"
alt="Like"
onClick={() => giveFeedback(1)}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 81.13 89.76">
<path d="M22.9 6a18.57 18.57 0 002.67 8.4 25.72 25.72 0 008.65 7.66c3.86 2 8.67 7.13 13.51 11 3.86 3.11 8.57 7.11 11.54 8.45s13.59.26 14.64 1.17c1.88 1.63 1.55 9-.11 15.25-1.61 5.86-5.96 10.55-6.48 16.86-.4 4.83-2.7 4.88-10.93 4.88h-1.35c-3.82 0-8.24 2.93-12.92 3.62a68 68 0 01-9.73.5c-3.57 0-7.86-.08-13.25-.08-3.56 0-4.71-1.83-4.71-4.48h8.42a3.51 3.51 0 000-7H12.28a2.89 2.89 0 01-2.88-2.88 1.91 1.91 0 01.77-1.78h16.46a3.51 3.51 0 000-7H12.29c-3.21 0-4.84-1.83-4.84-4a6.41 6.41 0 011.17-3.78h19.06a3.5 3.5 0 100-7H9.75A3.51 3.51 0 016 42.27a3.45 3.45 0 013.75-3.48h13.11c5.61 0 7.71-3 5.71-5.52-4.43-4.74-10.84-12.62-11-18.71-.15-6.51 2.6-7.83 5.36-8.56m0-6a6.18 6.18 0 00-1.53.2c-6.69 1.77-10 6.65-9.82 14.5.08 5.09 2.99 11.18 8.52 18.09H9.74a9.52 9.52 0 00-6.23 16.9 12.52 12.52 0 00-2.07 6.84 9.64 9.64 0 003.65 7.7 7.85 7.85 0 00-1.7 5.13 8.9 8.9 0 005.3 8.13 6 6 0 00-.26 1.76c0 6.37 4.2 10.48 10.71 10.48h13.25a73.75 73.75 0 0010.6-.56 35.89 35.89 0 007.58-2.18 17.83 17.83 0 014.48-1.34h1.35c4.69 0 7.79 0 10.5-1 3.85-1.44 6-4.59 6.41-9.38.2-2.46 1.42-4.85 2.84-7.62a41.3 41.3 0 003.42-8.13 48 48 0 001.59-10.79c.1-5.13-1-8.48-3.35-10.55-2.16-1.87-4.64-1.87-9.6-1.88a46.86 46.86 0 01-6.64-.29c-1.92-.94-5.72-4-8.51-6.3l-1.58-1.28c-1.6-1.3-3.27-2.79-4.87-4.23-3.33-3-6.47-5.79-9.61-7.45a20.2 20.2 0 01-6.43-5.53 12.44 12.44 0 01-1.72-5.36 6 6 0 00-6-5.86z" />
</svg>
<svg
className="i_thumbsdown"
alt="Dislike"
onClick={() => giveFeedback(0)}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 81.13 89.76">
<path d="M22.9 6a18.57 18.57 0 002.67 8.4 25.72 25.72 0 008.65 7.66c3.86 2 8.67 7.13 13.51 11 3.86 3.11 8.57 7.11 11.54 8.45s13.59.26 14.64 1.17c1.88 1.63 1.55 9-.11 15.25-1.61 5.86-5.96 10.55-6.48 16.86-.4 4.83-2.7 4.88-10.93 4.88h-1.35c-3.82 0-8.24 2.93-12.92 3.62a68 68 0 01-9.73.5c-3.57 0-7.86-.08-13.25-.08-3.56 0-4.71-1.83-4.71-4.48h8.42a3.51 3.51 0 000-7H12.28a2.89 2.89 0 01-2.88-2.88 1.91 1.91 0 01.77-1.78h16.46a3.51 3.51 0 000-7H12.29c-3.21 0-4.84-1.83-4.84-4a6.41 6.41 0 011.17-3.78h19.06a3.5 3.5 0 100-7H9.75A3.51 3.51 0 016 42.27a3.45 3.45 0 013.75-3.48h13.11c5.61 0 7.71-3 5.71-5.52-4.43-4.74-10.84-12.62-11-18.71-.15-6.51 2.6-7.83 5.36-8.56m0-6a6.18 6.18 0 00-1.53.2c-6.69 1.77-10 6.65-9.82 14.5.08 5.09 2.99 11.18 8.52 18.09H9.74a9.52 9.52 0 00-6.23 16.9 12.52 12.52 0 00-2.07 6.84 9.64 9.64 0 003.65 7.7 7.85 7.85 0 00-1.7 5.13 8.9 8.9 0 005.3 8.13 6 6 0 00-.26 1.76c0 6.37 4.2 10.48 10.71 10.48h13.25a73.75 73.75 0 0010.6-.56 35.89 35.89 0 007.58-2.18 17.83 17.83 0 014.48-1.34h1.35c4.69 0 7.79 0 10.5-1 3.85-1.44 6-4.59 6.41-9.38.2-2.46 1.42-4.85 2.84-7.62a41.3 41.3 0 003.42-8.13 48 48 0 001.59-10.79c.1-5.13-1-8.48-3.35-10.55-2.16-1.87-4.64-1.87-9.6-1.88a46.86 46.86 0 01-6.64-.29c-1.92-.94-5.72-4-8.51-6.3l-1.58-1.28c-1.6-1.3-3.27-2.79-4.87-4.23-3.33-3-6.47-5.79-9.61-7.45a20.2 20.2 0 01-6.43-5.53 12.44 12.44 0 01-1.72-5.36 6 6 0 00-6-5.86z" />
</svg>
</>
)}
</div>
);
};
export default DocsRating;

View File

@@ -0,0 +1,119 @@
const theme = {
plain: {
color: '#FFFFFF',
backgroundColor: '#282C34',
},
styles: [
{
types: ['property'],
style: {
color: '#2aa198',
},
},
{
types: ['attr-name', 'comment', 'prolog', 'doctype', 'cdata'],
style: {
color: '#93a1a1',
},
},
{
types: ['punctuation'],
style: {
color: '#657b83',
},
},
{
types: ['namespace'],
style: {
opacity: 0.7,
},
},
{
types: ['selector', 'char', 'builtin', 'url'],
style: {
color: '#2aa198',
},
},
{
types: ['entity'],
style: {
color: '#2aa198',
},
},
{
types: ['atrule', 'inserted'],
style: {
color: '#859900',
},
},
{
types: ['important', 'variable', 'deleted'],
style: {
color: '#cb4b16',
},
},
{
types: ['important', 'bold'],
style: {
fontWeight: 'bold',
},
},
{
types: ['italic'],
style: {
fontStyle: 'italic',
},
},
{
types: ['entity'],
style: {
cursor: 'help',
},
},
// react-native theme
{
types: ['attr-name', 'keyword'],
style: {
color: '#c5a5c5',
},
},
{
types: ['string', 'regex', 'attr-value'],
style: {
color: '#8dc891',
},
},
{
types: ['number', 'constant', 'symbol'],
style: {
color: '#5a9bcf',
},
},
{
types: ['boolean'],
style: {
color: '#ff8b50',
},
},
{
types: ['class-name'],
style: {
color: '#fac863',
},
},
{
types: ['function'],
style: {
color: '#79b6f2',
},
},
{
types: ['operator', 'tag'],
style: {
color: '#fc929e',
},
},
],
};
module.exports = theme;

View File

@@ -0,0 +1,22 @@
import React, {useState} from 'react';
import CodeBlock from '@theme/CodeBlock';
const TableRowWithCodeBlock = ({name, url, code}) => (
<tr>
<td>
{url ? (
<a href={url} target="_blank" rel="noopener noreferrer">
{name}
</a>
) : (
name
)}
</td>
<td>
<CodeBlock>{code}</CodeBlock>
</td>
</tr>
);
export default TableRowWithCodeBlock;

View File

@@ -0,0 +1,95 @@
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
const isMacOS = ExecutionEnvironment.canUseDOM
? navigator.platform.startsWith('Mac')
: false;
const isWindows = ExecutionEnvironment.canUseDOM
? navigator.platform.startsWith('Win')
: false;
const syntax = [
{label: 'Function Component', value: 'functional'},
{label: 'Class Component', value: 'classical'},
];
const defaultSyntax = 'functional';
const packageManagers = [
{label: 'npm', value: 'npm'},
{label: 'Yarn', value: 'yarn'},
];
const defaultPackageManager = 'npm';
const androidLanguages = [
{label: 'Java', value: 'java'},
{label: 'Kotlin', value: 'kotlin'},
];
const defaultAndroidLanguage = 'java';
const javaScriptSpecLanguages = [
{label: 'Flow', value: 'flow'},
{label: 'TypeScript', value: 'typescript'},
];
const defaultJavaScriptSpecLanguages = 'flow';
const guides = [{label: 'Install Dependencies', value: 'dep-install'}];
const defaultGuide = 'dep-install';
const guidesDocker = [{label: 'Installing Docker Images', value: 'docker-install'}];
const defaultGuideDocker = 'docker-install';
const platforms = [
{label: 'Android', value: 'android'},
{label: 'iOS', value: 'ios'},
];
const defaultPlatform = isMacOS ? 'ios' : 'android';
const oses = [
{label: 'macOS', value: 'macos'},
{label: 'Linux', value: 'linux'},
{label: 'Windows', value: 'windows'},
];
const defaultOs = isMacOS ? 'macos' : isWindows ? 'windows' : 'linux';
const getDevNotesTabs = (tabs = ['android', 'ios', 'web', 'windows']) =>
[
tabs.includes('android') ? {label: 'Android', value: 'android'} : undefined,
tabs.includes('ios') ? {label: 'iOS', value: 'ios'} : undefined,
tabs.includes('web') ? {label: 'Web', value: 'web'} : undefined,
tabs.includes('windows') ? {label: 'Windows', value: 'windows'} : undefined,
].filter(Boolean);
const getLibraryNotesTabs = (
tabs = ['researchers', 'data_scientist', 'engineer']
) =>
[
tabs.includes('researchers')
? {label: 'Researchers', value: 'researchers'}
: undefined,
tabs.includes('data_scientist')
? {label: 'Data Scientist', value: 'data_scientist'}
: undefined,
tabs.includes('engineer')
? {label: 'Python Engineer', value: 'engineer'}
: undefined,
].filter(Boolean);
export default {
defaultGuide,
defaultGuideDocker,
defaultOs,
defaultPackageManager,
defaultPlatform,
defaultSyntax,
defaultAndroidLanguage,
javaScriptSpecLanguages,
defaultJavaScriptSpecLanguages,
getDevNotesTabs,
getLibraryNotesTabs,
guides,
guidesDocker,
oses,
packageManagers,
platforms,
syntax,
androidLanguages,
};