@codecademy/codebytes 0.1.1-alpha.9d702d.0 → 0.1.1-alpha.d70fea.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ### [0.1.1-alpha.9d702d.0](https://github.com/Codecademy/client-modules/compare/@codecademy/codebytes@0.1.0...@codecademy/codebytes@0.1.1-alpha.9d702d.0) (2021-12-21)
6
+ ### [0.1.1-alpha.d70fea.0](https://github.com/Codecademy/client-modules/compare/@codecademy/codebytes@0.1.0...@codecademy/codebytes@0.1.1-alpha.d70fea.0) (2022-01-04)
7
7
 
8
8
  **Note:** Version bump only for package @codecademy/codebytes
9
9
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecademy/codebytes",
3
3
  "description": "Codebytes Code Editor",
4
- "version": "0.1.1-alpha.9d702d.0",
4
+ "version": "0.1.1-alpha.d70fea.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "sideEffects": [
7
7
  "**/*.css",
@@ -23,8 +23,13 @@
23
23
  "@codecademy/gamut": "*",
24
24
  "@codecademy/gamut-icons": "*",
25
25
  "@codecademy/gamut-styles": "*",
26
+ "@codecademy/variance": "*",
26
27
  "@emotion/react": "^11.4.0",
27
- "@emotion/styled": "^11.3.0"
28
+ "@emotion/styled": "^11.3.0",
29
+ "@loadable/component": "^5.13.1",
30
+ "monaco-editor": "0.20.0",
31
+ "react-monaco-editor": "0.34.0",
32
+ "react-resize-observer": "1.1.1"
28
33
  },
29
34
  "scripts": {
30
35
  "verify": "tsc --noEmit",
@@ -38,10 +43,12 @@
38
43
  "devDependencies": {
39
44
  "@emotion/jest": "^11.3.0",
40
45
  "@testing-library/dom": "^7.31.2",
41
- "@testing-library/react": "^11.0.4"
46
+ "@testing-library/react": "^11.0.4",
47
+ "@types/loadable__component": "^5.13.2",
48
+ "monaco-editor-webpack-plugin": "1.9.1"
42
49
  },
43
50
  "publishConfig": {
44
51
  "access": "public"
45
52
  },
46
- "gitHead": "61905c84b7898bbfe7dbd2702afed7911d5eaf6b"
53
+ "gitHead": "f5f3ae54fe29c84add4703606aecc86c878da33c"
47
54
  }
@@ -0,0 +1,54 @@
1
+ // DO NOT CHANGE ANYTHING HERE
2
+ // This file is part of the Codebytes MVP and only includes basic configuration around theming for the SimpleMonacoEditor component
3
+ // We are working on a monaco package in client-modules that has more configuration around themes and languages
4
+ // Monaco as a shared package RFC https://www.notion.so/codecademy/Monaco-editor-as-a-shared-package-1f4484db165b4abc8394c3556451ef6a
5
+
6
+ import { colors, editorColors } from '@codecademy/gamut-styles';
7
+
8
+ const darkTheme = {
9
+ blue: editorColors.blue,
10
+ deepPurple: editorColors.deepPurple,
11
+ gray: editorColors.gray,
12
+ green: editorColors.green,
13
+ orange: editorColors.orange,
14
+ purple: editorColors.purple,
15
+ red: editorColors.red,
16
+ white: colors.white,
17
+ yellow: editorColors.yellow,
18
+ };
19
+
20
+ export const syntax = {
21
+ attribute: darkTheme.green,
22
+ annotation: darkTheme.red,
23
+ atom: darkTheme.deepPurple,
24
+ basic: darkTheme.white,
25
+ comment: darkTheme.gray,
26
+ constant: darkTheme.orange,
27
+ decoration: darkTheme.red,
28
+ invalid: darkTheme.red,
29
+ key: darkTheme.blue,
30
+ keyword: darkTheme.purple,
31
+ number: darkTheme.red,
32
+ operator: darkTheme.red,
33
+ predefined: darkTheme.white,
34
+ property: darkTheme.red,
35
+ regexp: darkTheme.green,
36
+ string: darkTheme.yellow,
37
+ tag: darkTheme.red,
38
+ text: darkTheme.orange,
39
+ value: darkTheme.yellow,
40
+ variable: darkTheme.green,
41
+ };
42
+
43
+ export const ui = {
44
+ background: '#211E2F',
45
+ text: darkTheme.white,
46
+ indent: {
47
+ active: '#393b41',
48
+ inactive: '#494b51',
49
+ },
50
+ };
51
+
52
+ export type SyntaxColors = typeof syntax;
53
+
54
+ export type UIColors = typeof ui;
@@ -0,0 +1,53 @@
1
+ // DO NOT CHANGE ANYTHING HERE
2
+ // This component is part of the Codebytes MVP and only includes basic configuration around theming
3
+ // We are working on a monaco package in client-modules that has more configuration around themes and languages
4
+ // Monaco as a shared package RFC https://www.notion.so/codecademy/Monaco-editor-as-a-shared-package-1f4484db165b4abc8394c3556451ef6a
5
+
6
+ import loadable from '@loadable/component';
7
+ import React, { useCallback, useRef } from 'react';
8
+ import MonacoEditor from 'react-monaco-editor';
9
+ import ResizeObserver from 'react-resize-observer';
10
+
11
+ import { dark } from './theme';
12
+ import { Monaco } from './types';
13
+
14
+ const ReactMonacoEditor = loadable(() => import('react-monaco-editor'));
15
+
16
+ export type SimpleMonacoEditorProps = {
17
+ value: string;
18
+ language: string;
19
+ onChange?: (value: string) => void;
20
+ };
21
+
22
+ export const SimpleMonacoEditor: React.FC<SimpleMonacoEditorProps> = ({
23
+ value,
24
+ language,
25
+ onChange,
26
+ }) => {
27
+ const editorRef = useRef<MonacoEditor>(null);
28
+ const editorWillMount = useCallback((monaco: Monaco) => {
29
+ monaco.editor.defineTheme('dark', dark);
30
+ monaco.editor.setTheme('dark');
31
+ }, []);
32
+ return (
33
+ <>
34
+ <ResizeObserver
35
+ onResize={({ height, width }) => {
36
+ editorRef.current?.editor?.layout({
37
+ height,
38
+ width,
39
+ });
40
+ }}
41
+ />
42
+ <ReactMonacoEditor
43
+ ref={editorRef}
44
+ editorWillMount={editorWillMount}
45
+ onChange={onChange}
46
+ options={{ minimap: { enabled: false } }}
47
+ theme="dark"
48
+ value={value}
49
+ language={language}
50
+ />
51
+ </>
52
+ );
53
+ };
@@ -0,0 +1,64 @@
1
+ // DO NOT CHANGE ANYTHING HERE
2
+ // This file is part of the Codebytes MVP and only includes basic configuration around theming for the SimpleMonacoEditor component
3
+ // We are working on a monaco package in client-modules that has more configuration around themes and languages
4
+ // Monaco as a shared package RFC https://www.notion.so/codecademy/Monaco-editor-as-a-shared-package-1f4484db165b4abc8394c3556451ef6a
5
+
6
+ import type * as monaco from 'monaco-editor';
7
+
8
+ import * as darkColors from './colorsDark';
9
+
10
+ const c = (color: string) => color.substr(1);
11
+
12
+ const theme = ({
13
+ ui,
14
+ syntax,
15
+ }: {
16
+ ui: darkColors.UIColors;
17
+ syntax: darkColors.SyntaxColors;
18
+ }): monaco.editor.IStandaloneThemeData => ({
19
+ base: 'vs-dark',
20
+ inherit: true,
21
+ rules: [
22
+ // Base
23
+ { token: '', foreground: c(syntax.basic) },
24
+ { token: 'regexp', foreground: c(syntax.regexp) },
25
+ { token: 'annotation', foreground: c(syntax.annotation) },
26
+ { token: 'type', foreground: c(syntax.annotation) },
27
+ { token: 'doctype', foreground: c(syntax.comment) },
28
+ { token: 'delimiter', foreground: c(syntax.decoration) },
29
+ { token: 'invalid', foreground: c(syntax.invalid) },
30
+ { token: 'emphasis', fontStyle: 'italic' },
31
+ { token: 'strong', fontStyle: 'bold' },
32
+ { token: 'variable', foreground: c(syntax.variable) },
33
+ { token: 'variable.predefined', foreground: c(syntax.variable) },
34
+ { token: 'constant', foreground: c(syntax.constant) },
35
+ { token: 'comment', foreground: c(syntax.comment) },
36
+ { token: 'number', foreground: c(syntax.number) },
37
+ { token: 'number.hex', foreground: c(syntax.number) },
38
+ { token: 'keyword.directive', foreground: c(syntax.comment) },
39
+ { token: 'include', foreground: c(syntax.comment) },
40
+ { token: 'key', foreground: c(syntax.property) },
41
+ { token: 'attribute.name', foreground: c(syntax.attribute) },
42
+ { token: 'attribute.name-numeric', foreground: c(syntax.string) },
43
+ { token: 'attribute.value', foreground: c(syntax.property) },
44
+ { token: 'attribute.value.number', foreground: c(syntax.number) },
45
+ { token: 'string', foreground: c(syntax.string) },
46
+ { token: 'string.yaml', foreground: c(syntax.string) },
47
+ { token: 'tag', foreground: c(syntax.tag) },
48
+ { token: 'tag.id.jade', foreground: c(syntax.tag) },
49
+ { token: 'tag.class.jade', foreground: c(syntax.tag) },
50
+ { token: 'metatag', foreground: c(syntax.comment) },
51
+ { token: 'attribute.value.unit', foreground: c(syntax.string) },
52
+ { token: 'keyword', foreground: c(syntax.keyword) },
53
+ { token: 'keyword.flow', foreground: c(syntax.keyword) },
54
+ ],
55
+ colors: {
56
+ 'editor.background': ui.background,
57
+ 'editor.foreground': ui.text,
58
+ 'editorIndentGuide.background': ui.indent.inactive,
59
+ 'editorIndentGuide.activeBackground': ui.indent.active,
60
+ 'editorWhitespace.foreground': syntax.comment,
61
+ },
62
+ });
63
+
64
+ export const dark = theme(darkColors);
@@ -0,0 +1 @@
1
+ export type Monaco = typeof import('monaco-editor');
package/src/api.ts ADDED
@@ -0,0 +1,28 @@
1
+ import type { languageOption } from './consts';
2
+
3
+ interface Response {
4
+ stderr: string;
5
+ stdout: string;
6
+ exit_code: number;
7
+ }
8
+
9
+ interface PostSnippetData {
10
+ language: languageOption;
11
+ code: string;
12
+ }
13
+
14
+ export const postSnippet = async (
15
+ data: PostSnippetData,
16
+ snippetsBaseUrl?: string
17
+ ): Promise<Response> => {
18
+ const snippetsEndpoint = `https://${snippetsBaseUrl}/snippets`;
19
+
20
+ const response = await fetch(snippetsEndpoint, {
21
+ method: 'POST',
22
+ body: JSON.stringify(data),
23
+ headers: {
24
+ 'x-codecademy-user-id': 'codebytes-anon-user',
25
+ },
26
+ });
27
+ return response.json();
28
+ };
package/src/drawers.tsx CHANGED
@@ -19,7 +19,7 @@ const Drawer = styled(FlexBox)<{ open?: boolean; hideOnClose?: boolean }>`
19
19
  position: relative;
20
20
  ${({ open, hideOnClose }) => `
21
21
  flex-basis: ${open ? '100%' : '0%'};
22
- ${!open && hideOnClose ? 'visibility: hidden;' : ''}
22
+ visibility: ${!open && hideOnClose ? 'hidden' : 'visible'};
23
23
  transition: flex-basis 0.2s ${
24
24
  open ? 'ease-out' : 'ease-in, visibility 0s 0.2s'
25
25
  };
@@ -36,48 +36,52 @@ export type DrawersProps = {
36
36
  };
37
37
 
38
38
  export const Drawers: React.FC<DrawersProps> = ({ leftChild, rightChild }) => {
39
- const [show, setShow] = useState<'left' | 'right' | 'both'>('both');
39
+ const [open, setOpen] = useState<'left' | 'right' | 'both'>('both');
40
40
 
41
- let buttonLabelL = 'hide code';
42
- let buttonLabelR = 'hide output';
41
+ let ariaLabelCodeButton = 'hide code';
42
+ let ariaLabelOutputButton = 'hide output';
43
+ let isLeftOpen = false;
44
+ let isRightOpen = false;
43
45
 
44
- if (show === 'left') {
45
- buttonLabelL = buttonLabelR = 'show output';
46
- } else if (show === 'right') {
47
- buttonLabelL = buttonLabelR = 'show code';
46
+ if (open === 'left') {
47
+ ariaLabelCodeButton = ariaLabelOutputButton = 'show output';
48
+ isLeftOpen = true;
49
+ } else if (open === 'right') {
50
+ ariaLabelCodeButton = ariaLabelOutputButton = 'show code';
51
+ isRightOpen = true;
48
52
  }
49
53
 
50
54
  return (
51
55
  <>
52
56
  <FlexBox>
53
57
  <Drawer
54
- open={show !== 'right'}
58
+ open={!isRightOpen}
55
59
  alignItems="center"
56
60
  flexWrap="nowrap"
57
61
  textAlign="left"
58
- borderRight="1"
62
+ borderRight={1}
59
63
  borderColor="gray-900"
60
- px="8"
64
+ px={8}
61
65
  >
62
66
  <IconButton
63
67
  icon={LeftDrawerIcon}
64
68
  variant="secondary"
65
69
  size="small"
66
70
  onClick={() =>
67
- setShow((state) => (state === 'both' ? 'right' : 'both'))
71
+ setOpen((state) => (state === 'both' ? 'right' : 'both'))
68
72
  }
69
- aria-label={buttonLabelL}
73
+ aria-label={ariaLabelCodeButton}
70
74
  aria-controls="code-drawer"
71
- aria-expanded={show !== 'right'}
75
+ aria-expanded={!isRightOpen}
72
76
  />
73
77
  <DrawerLabel id="code-drawer-label">Code</DrawerLabel>
74
78
  </Drawer>
75
79
  <Drawer
76
- open={show !== 'left'}
80
+ open={!isLeftOpen}
77
81
  alignItems="center"
78
82
  flexWrap="nowrap"
79
83
  justifyContent="flex-end"
80
- px="8"
84
+ px={8}
81
85
  >
82
86
  <DrawerLabel id="output-drawer-label">Output</DrawerLabel>
83
87
  <IconButton
@@ -85,17 +89,17 @@ export const Drawers: React.FC<DrawersProps> = ({ leftChild, rightChild }) => {
85
89
  variant="secondary"
86
90
  size="small"
87
91
  onClick={() =>
88
- setShow((state) => (state === 'both' ? 'left' : 'both'))
92
+ setOpen((state) => (state === 'both' ? 'left' : 'both'))
89
93
  }
90
- aria-label={buttonLabelR}
94
+ aria-label={ariaLabelOutputButton}
91
95
  aria-controls="output-drawer"
92
- aria-expanded={show !== 'left'}
96
+ aria-expanded={!isLeftOpen}
93
97
  />
94
98
  </Drawer>
95
99
  </FlexBox>
96
100
  <FlexBox
97
101
  flexGrow={1}
98
- borderY="1"
102
+ borderY={1}
99
103
  borderColor="gray-900"
100
104
  alignItems="stretch"
101
105
  overflow="hidden"
@@ -104,7 +108,7 @@ export const Drawers: React.FC<DrawersProps> = ({ leftChild, rightChild }) => {
104
108
  hideOnClose
105
109
  id="code-drawer"
106
110
  aria-labelledby="code-drawer-label"
107
- open={show !== 'right'}
111
+ open={!isRightOpen}
108
112
  flexGrow={0}
109
113
  overflow="hidden"
110
114
  borderColor="gray-900"
@@ -117,7 +121,7 @@ export const Drawers: React.FC<DrawersProps> = ({ leftChild, rightChild }) => {
117
121
  hideOnClose
118
122
  id="output-drawer"
119
123
  aria-labelledby="output-drawer-label"
120
- open={show !== 'left'}
124
+ open={!isLeftOpen}
121
125
  overflow="hidden"
122
126
  >
123
127
  {rightChild}
package/src/editor.tsx CHANGED
@@ -10,12 +10,14 @@ import { theme } from '@codecademy/gamut-styles';
10
10
  import styled from '@emotion/styled';
11
11
  import React, { useState } from 'react';
12
12
 
13
+ import { postSnippet } from './api';
13
14
  import type { languageOption } from './consts';
14
15
  import { Drawers } from './drawers';
16
+ import { SimpleMonacoEditor } from './MonacoEditor';
15
17
 
16
18
  const Output = styled.pre<{ hasError: boolean }>`
17
19
  width: 100%;
18
- height: 20rem;
20
+ height: 100%;
19
21
  margin: 0;
20
22
  padding: 0 1rem;
21
23
  font-family: Monaco;
@@ -42,19 +44,16 @@ type EditorProps = {
42
44
  text: string
43
45
  ) => void /* TODO: Add onChange behavior in DISC-353 */;
44
46
  onCopy?: (text: string, language: string) => void;
47
+ snippetsBaseUrl?: string;
45
48
  };
46
49
 
47
- interface Response {
48
- stderr: string;
49
- stdout: string;
50
- exit_code: number;
51
- }
52
-
53
50
  export const Editor: React.FC<EditorProps> = ({
54
51
  language,
55
52
  text,
56
53
  hideCopyButton,
57
54
  onCopy,
55
+ onChange,
56
+ snippetsBaseUrl,
58
57
  }) => {
59
58
  const [output, setOutput] = useState('');
60
59
  const [status, setStatus] = useState<'ready' | 'waiting' | 'error'>('ready');
@@ -65,10 +64,7 @@ export const Editor: React.FC<EditorProps> = ({
65
64
  .writeText(text)
66
65
  // eslint-disable-next-line no-console
67
66
  .catch(() => console.error('Failed to copy'));
68
- onCopy?.(
69
- text,
70
- language
71
- ); /* TODO: pass in onCopyBBCodeblock behavior from the future version we migrate to Next.js */
67
+ onCopy?.(text, language);
72
68
  setIsCodeByteCopied(true);
73
69
  }
74
70
  };
@@ -78,7 +74,7 @@ export const Editor: React.FC<EditorProps> = ({
78
74
  setStatus('error');
79
75
  };
80
76
 
81
- const handleSubmit = () => {
77
+ const handleSubmit = async () => {
82
78
  if (text.trim().length === 0) {
83
79
  return;
84
80
  }
@@ -89,40 +85,35 @@ export const Editor: React.FC<EditorProps> = ({
89
85
  setStatus('waiting');
90
86
  setOutput('');
91
87
 
92
- const snippetsEndpoint =
93
- 'https://' + process.env.GATSBY_CONTAINER_API_BASE + '/snippets';
94
-
95
- fetch(snippetsEndpoint, {
96
- method: 'POST',
97
- body: JSON.stringify(data),
98
- headers: {
99
- 'x-codecademy-user-id': 'codebytes-anon-user',
100
- },
101
- })
102
- .then((res) => res.json())
103
- .then((response: Response) => {
104
- if (response.stderr.length > 0) {
105
- setErrorStatusAndOutput(response.stderr);
106
- } else if (response.exit_code === DOCKER_SIGTERM) {
107
- setErrorStatusAndOutput(
108
- 'Your code took too long to return a result. Double check your code for any issues and try again!'
109
- );
110
- } else if (response.exit_code !== 0) {
111
- setErrorStatusAndOutput('An unknown error occured.');
112
- } else {
113
- setOutput(response.stdout);
114
- setStatus('ready');
115
- }
116
- })
117
- .catch((error) => {
118
- setErrorStatusAndOutput('Error: ' + error);
119
- });
88
+ try {
89
+ const response = await postSnippet(data, snippetsBaseUrl);
90
+ if (response.stderr.length > 0) {
91
+ setErrorStatusAndOutput(response.stderr);
92
+ } else if (response.exit_code === DOCKER_SIGTERM) {
93
+ setErrorStatusAndOutput(
94
+ 'Your code took too long to return a result. Double check your code for any issues and try again!'
95
+ );
96
+ } else if (response.exit_code !== 0) {
97
+ setErrorStatusAndOutput('An unknown error occured.');
98
+ } else {
99
+ setOutput(response.stdout);
100
+ setStatus('ready');
101
+ }
102
+ } catch (error) {
103
+ setErrorStatusAndOutput('Error: ' + error);
104
+ }
120
105
  };
121
106
 
122
107
  return (
123
108
  <>
124
109
  <Drawers
125
- leftChild={<div>{text}</div>}
110
+ leftChild={
111
+ <SimpleMonacoEditor
112
+ value={text}
113
+ language={language}
114
+ onChange={onChange}
115
+ />
116
+ }
126
117
  rightChild={
127
118
  <Output hasError={status === 'error'} aria-live="polite">
128
119
  {output}
@@ -131,7 +122,7 @@ export const Editor: React.FC<EditorProps> = ({
131
122
  />
132
123
  <FlexBox
133
124
  justifyContent={hideCopyButton ? 'flex-end' : 'space-between'}
134
- pl="8"
125
+ pl={8}
135
126
  >
136
127
  {!hideCopyButton ? (
137
128
  <ToolTip
package/src/index.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Box, IconButton } from '@codecademy/gamut';
2
2
  import { FaviconIcon } from '@codecademy/gamut-icons';
3
- import { Background, system } from '@codecademy/gamut-styles';
3
+ import { Background, states, system } from '@codecademy/gamut-styles';
4
+ import { StyleProps } from '@codecademy/variance';
4
5
  import styled from '@emotion/styled';
5
6
  import React, { useState } from 'react';
6
7
 
@@ -12,18 +13,31 @@ export interface CodeByteEditorProps {
12
13
  language: languageOption;
13
14
  hideCopyButton: boolean;
14
15
  onCopy?: (text: string, language: string) => void;
16
+ isIFrame?: boolean;
17
+ snippetsBaseUrl?: string;
18
+ onTextChange?: (text: string) => void;
15
19
  }
16
20
 
17
- const EditorContainer = styled(Background)(
18
- system.css({
19
- border: '1',
20
- borderColor: 'gray-900',
21
- display: 'flex',
22
- flexDirection: 'column',
23
- height: '400px',
24
- width: '688px',
25
- overflow: 'hidden',
26
- })
21
+ const editorStates = states({
22
+ isIFrame: { height: '100vh' },
23
+ });
24
+
25
+ const editorBaseStyles = system.css({
26
+ border: 1,
27
+ borderColor: 'gray-900',
28
+ display: 'flex',
29
+ flexDirection: 'column',
30
+ height: '400px',
31
+ width: '688px',
32
+ overflow: 'hidden',
33
+ });
34
+ export interface EditorStyleProps
35
+ extends StyleProps<typeof editorBaseStyles>,
36
+ StyleProps<typeof editorStates> {}
37
+
38
+ const EditorContainer = styled(Background)<EditorStyleProps>(
39
+ editorBaseStyles,
40
+ editorStates
27
41
  );
28
42
 
29
43
  export const CodeByteEditor: React.FC<CodeByteEditorProps> = ({
@@ -31,32 +45,35 @@ export const CodeByteEditor: React.FC<CodeByteEditorProps> = ({
31
45
  language,
32
46
  hideCopyButton,
33
47
  onCopy,
48
+ isIFrame = false,
49
+ snippetsBaseUrl = '',
50
+ onTextChange,
34
51
  }) => {
35
52
  const [text, setText] = useState<string>(initialText);
36
53
  return (
37
- <>
38
- <EditorContainer bg="black" as="main">
39
- <Box borderBottom="1" borderColor="gray-900" py="4" pl="8">
40
- <IconButton
41
- icon={FaviconIcon}
42
- variant="secondary"
43
- href="https://www.codecademy.com/"
44
- target="_blank"
45
- rel="noreferrer"
46
- aria-label="visit codecademy.com"
47
- />
48
- </Box>
49
- <Editor
50
- language={language}
51
- text={text}
52
- hideCopyButton={hideCopyButton}
53
- onChange={(newText: string) => {
54
- setText(newText);
55
- }}
56
- onCopy={onCopy}
54
+ <EditorContainer bg="black" as="main" isIFrame={isIFrame}>
55
+ <Box borderBottom={1} borderColor="gray-900" py={4} pl={8}>
56
+ <IconButton
57
+ icon={FaviconIcon}
58
+ variant="secondary"
59
+ href="https://www.codecademy.com/"
60
+ target="_blank"
61
+ rel="noreferrer"
62
+ aria-label="visit codecademy.com"
57
63
  />
58
- </EditorContainer>
59
- </>
64
+ </Box>
65
+ <Editor
66
+ language={language}
67
+ text={text}
68
+ hideCopyButton={hideCopyButton}
69
+ onChange={(newText: string) => {
70
+ setText(newText);
71
+ onTextChange?.(newText);
72
+ }}
73
+ onCopy={onCopy}
74
+ snippetsBaseUrl={snippetsBaseUrl}
75
+ />
76
+ </EditorContainer>
60
77
  );
61
78
  };
62
79
 
package/src/theme.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { CoreTheme } from '@codecademy/gamut-styles';
2
+ declare module '@emotion/react' {
3
+ export interface Theme extends CoreTheme {}
4
+ }