diff --git a/src/components/Terminal/Shell.js b/src/components/Terminal/Shell.js new file mode 100644 index 000000000..1f2e14864 --- /dev/null +++ b/src/components/Terminal/Shell.js @@ -0,0 +1,60 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { css } from '@emotion/core'; +import Command from './Command'; +import theme from './theme'; +import rollupIntoCommands from './rollupIntoCommands'; + +const Shell = ({ highlight, code }) => { + return ( +
code {
+ background: none;
+ padding: 0;
+ width: 100%;
+ }
+
+ .token-line {
+ display: grid;
+ grid-template-columns: 1ch 1fr;
+ grid-gap: 1rem;
+ }
+ `}
+ >
+
+ {rollupIntoCommands(highlight.tokens, code).map((command, idx) => (
+
+ ))}
+
+
+ );
+};
+
+Shell.propTypes = {
+ code: PropTypes.string.isRequired,
+ highlight: PropTypes.object,
+};
+
+export default Shell;
diff --git a/src/components/Terminal/Terminal.js b/src/components/Terminal/Terminal.js
index d33cb9bdd..9427dda62 100644
--- a/src/components/Terminal/Terminal.js
+++ b/src/components/Terminal/Terminal.js
@@ -4,9 +4,8 @@ import { css } from '@emotion/core';
import { Button, useClipboard } from '@newrelic/gatsby-theme-newrelic';
import Highlight from 'prism-react-renderer';
import Prism from 'prismjs';
-import Command from './Command';
+import Shell from './Shell';
import theme from './theme';
-import rollupIntoCommands from './rollupIntoCommands';
const Terminal = ({ children }) => {
const code = children.trim();
@@ -61,52 +60,9 @@ const Terminal = ({ children }) => {
{copied ? 'Copied' : 'Copy'}
- code {
- background: none;
- padding: 0;
- width: 100%;
- }
-
- .token-line {
- display: grid;
- grid-template-columns: 1ch 1fr;
- grid-gap: 1rem;
- }
- `}
- >
-
-
- {({ tokens, getTokenProps }) =>
- rollupIntoCommands(tokens, code).map((command, idx) => (
-
- ))
- }
-
-
-
+