-
-
Notifications
You must be signed in to change notification settings - Fork 232
/
playground.tsx
70 lines (65 loc) 路 3 KB
/
playground.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import Head from '@docusaurus/Head';
import useBaseUrl from '@docusaurus/useBaseUrl';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import AnnouncementBar from '@theme/AnnouncementBar';
import Footer from '@theme/Footer';
import Navbar from '@theme/Navbar';
import ThemeProvider from '@theme/ThemeProvider';
import UserPreferencesProvider from '@theme/UserPreferencesProvider';
import clsx from 'clsx';
import React from 'react';
import { Playground } from '@remirror/playground';
import styles from './playground.module.css';
const PlaygroundPage = (props: any) => {
const { siteConfig } = useDocusaurusContext();
const { favicon, url: siteUrl } = siteConfig!;
const defaultImage = siteConfig?.themeConfig?.image;
const { noFooter, description, image, keywords, permalink, version } = props;
const metaImage = image || defaultImage;
const metaImageUrl = useBaseUrl(metaImage, { absolute: true });
const faviconUrl = useBaseUrl(favicon);
return (
<div className={clsx('playground', styles.playground)}>
<ThemeProvider>
<UserPreferencesProvider>
<Head>
{/* TODO: Do not assume that it is in english language site */}
<html lang='en' />
<script src='https://unpkg.com/@babel/standalone/babel.min.js'></script>
<script src='https://unpkg.com/prettier@2.1.2/standalone.js'></script>
<script src='https://unpkg.com/prettier@2.1.2/parser-typescript.js'></script>
<title>Remirror Playground</title>
<meta property='og:title' content='Remirror Playground' />
{favicon ?? <link rel='shortcut icon' href={faviconUrl} />}
{description ?? <meta name='description' content={description} />}
{description ?? <meta property='og:description' content={description} />}
{version ?? <meta name='docsearch:version' content={version} />}
{keywords?.length ?? <meta name='keywords' content={keywords?.join(',')} />}
{metaImage ?? <meta property='og:image' content={metaImageUrl} />}
{metaImage ?? <meta property='twitter:image' content={metaImageUrl} />}
{metaImage ?? <meta name='twitter:image:alt' content='Image for Remirror Playground' />}
{permalink ?? <meta property='og:url' content={siteUrl + permalink} />}
{permalink ?? <link rel='canonical' href={siteUrl + permalink} />}
<meta name='twitter:card' content='summary_large_image' />
</Head>
<AnnouncementBar />
<Navbar />
<Head></Head>
<div
className='custom-main-wrapper'
style={{
/* TODO: move this to CSS, make sensible */
position: 'relative',
height: 'calc(100vh - 17rem + 3px)',
minHeight: '400px',
}}
>
<Playground />
</div>
{!noFooter && <Footer />}
</UserPreferencesProvider>
</ThemeProvider>
</div>
);
};
export default PlaygroundPage;