-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
index.tsx
181 lines (172 loc) · 5.08 KB
/
index.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import React from 'react';
import { Link } from 'react-router-dom';
import styled, { keyframes } from 'styled-components';
import GitHubCorners from '@uiw/react-github-corners';
import Github from '@uiw/react-shields/esm/github';
import Npm from '@uiw/react-shields/esm/npm';
import BackToUp from '@uiw/react-back-to-top';
import logo from '../../logo.png';
import Example from './Example';
const rotate = keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`;
const AppLogo = styled.img`
animation: ${rotate} infinite 20s linear;
height: 80px;
`;
const AppTitle = styled.h1`
font-size: 30px;
sup {
position: absolute;
background: var(--color-neutral-muted);
padding: 1px 5px;
font-size: 12px;
border-radius: 3px;
}
`;
const Describe = styled.p`
font-size: 18px;
color: #a5a5a5;
font-weight: 200;
`;
const Buttons = styled.div`
a {
outline: none;
min-height: 30px;
margin: 6px 5px;
padding: 0 10px;
font-size: 14px;
display: inline-block;
position: relative;
overflow: hidden;
user-select: none;
border-radius: 3px;
cursor: pointer;
background: var(--color-neutral-muted);
color: var(--color-theme-text);
line-height: 30px;
text-decoration: none;
&.themes {
background-color: var(--color-prettylights-syntax-variable);
color: var(--color-prettylights-syntax-carriage-return-text);
}
&.special {
background: var(--color-prettylights-syntax-markup-ignored-bg);
color: var(--color-prettylights-syntax-carriage-return-text);
}
&.extensions {
background: var(--color-prettylights-syntax-brackethighlighter-unmatched);
color: var(--color-prettylights-syntax-carriage-return-text);
}
&:hover {
background-color: var(--color-fg-muted);
color: var(--color-theme-bg);
transition: background-color 0.25s linear, color 0.05s linear, opacity 0.25s linear, filter 0.25s linear,
visibility 0.25s linear, transform 0.25s linear;
}
&:last-child {
color: var(--color-prettylights-syntax-keyword);
}
}
`;
const Footer = styled.div`
text-align: center;
padding-top: 30px;
padding-bottom: 160px;
a {
text-decoration: none;
}
`;
const AppHeader = styled.div`
background-color: var(--color-canvas-subtle);
box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.1), 0 1px rgba(0, 0, 0, 0.1);
padding: 120px 20px 40px 20px;
border-bottom: 1px solid var(--color-canvas-default);
position: relative;
z-index: 9;
text-align: center;
`;
const hyperlink: {
href: string;
label: string;
style?: React.CSSProperties;
}[] = [
{
href: 'https://www.npmjs.com/package/@uiw/react-codemirror',
label: 'On NPM',
},
{
href: 'https://codemirror.net/docs/',
label: 'CM Documentation',
},
{
href: 'https://github.com/uiwjs/react-codemirror',
label: 'Github',
},
// {
// href: 'https://github.com/codemirror/dev',
// label: 'CodeMirror GitHub',
// },
{
href: 'https://raw.githack.com/uiwjs/react-codemirror/doc3/index.html',
label: 'V3 Doc',
style: { color: 'red' },
},
];
export function Component() {
const version = VERSION;
return (
<div className="wmde-markdown-var">
<BackToUp>Top</BackToUp>
<dark-mode permanent dark="Dark" light="Light" style={{ position: 'fixed', top: 8, left: 8, zIndex: 99 }} />
<GitHubCorners fixed target="__blank" zIndex={10} href="https://github.com/uiwjs/react-codemirror" />
<AppHeader>
<AppLogo src={logo} alt="logo" />
<AppTitle>
React CodeMirror <sup>v{version}</sup>
</AppTitle>
<Describe>CodeMirror component for React. </Describe>
<Buttons>
<Link to="/editor/theme" className="special">
Theme Editor
</Link>
<Link to="/theme" className="themes">
Themes
</Link>
<Link to="/extensions" className="extensions">
Extensions
</Link>
<Link to="/merge/document">Merge</Link>
{hyperlink.map(({ href, label, style }, idx) => {
return (
<a key={idx} target="_blank" rel="noopener noreferrer" href={href} style={style}>
{label}
</a>
);
})}
</Buttons>
</AppHeader>
<Example />
<Footer>
<Github user="uiwjs" repo="react-codemirror">
<Github.Social type="forks" href="https://github.com/uiwjs/react-codemirror" />
<Github.Social type="stars" href="https://github.com/uiwjs/react-codemirror/stargazers" />
<Github.Social type="watchers" href="https://github.com/uiwjs/react-codemirror/watchers" />
<a href="https://www.npmjs.com/package/@uiw/react-codemirror" target="__blank">
<img src="https://img.shields.io/npm/dm/@uiw/react-codemirror.svg?style=flat" alt="NPM Downloads" />
</a>
</Github>
<Npm.Version
scope="@uiw"
packageName="react-codemirror"
href="https://www.npmjs.com/package/@uiw/react-codemirror"
/>
</Footer>
</div>
);
}