-
copy(getCopyOutput(lines))}
- />
- code {
- background: none;
- padding: 0;
- width: 100%;
- }
-
- .token-line {
- display: grid;
- grid-template-columns: 1ch 1fr;
- grid-gap: 1rem;
- }
- `}
- >
-
- {state.matches('idle') && }
- {renderedLines.map(({ type, line }, idx) => {
- const previousLine = renderedLines[idx - 1];
-
- return type === 'OUTPUT' ? (
-
- ) : (
- '
- : '$'
- }
- typingDelay={getTypingDelay(line, previousLine)}
- onFinishedTyping={() => send('PRESS_ENTER')}
- >
- {line.map((token, key) => (
- // eslint-disable-next-line react/jsx-key
-
- ))}
-
- );
- })}
-
-
-
- );
-};
-
-const getCopyOutput = (lines) => {
- return lines
- .filter(({ type }) => ['COMMAND', 'MULTILINE_COMMAND'].includes(type))
- .map(({ line }) =>
- line
- .filter((token) => !token.types.includes('comment'))
- .map((token) => token.content)
- .join('')
- .trimEnd()
- )
- .filter(Boolean)
- .join('\n');
-};
-
-const getTypingDelay = (line, previousLine) => {
- // Delay the first line more than every other line to allow time for the user
- // to adjust to the animation after scrolling the terminal into view
- if (!previousLine) {
- return 1500;
- }
-
- // Allow commands immediately following output space to breathe so that the
- // user has time to ingest the output before the typing animation begins again
- if (previousLine.type === 'OUTPUT') {
- return Math.max(800, gaussianRound(1000, 50));
- }
-
- // If we are starting a new command after typing a previous command, delay
- // the typing just a bit, unless we are continuing a multiline command
- if (line.type === 'COMMAND' || previousLine.type !== 'MULTILINE_COMMAND') {
- return Math.max(250, gaussianRound(250, 25));
- }
-
- return 0;
-};
-
-Shell.propTypes = {
- animate: PropTypes.bool,
- code: PropTypes.string.isRequired,
- copyable: PropTypes.bool,
- highlight: PropTypes.shape({
- tokens: PropTypes.array.isRequired,
- getTokenProps: PropTypes.func.isRequired,
- }),
-};
-
-export default Shell;
diff --git a/src/components/Terminal/ShellOutput.js b/src/components/Terminal/ShellOutput.js
deleted file mode 100644
index 08d17b222..000000000
--- a/src/components/Terminal/ShellOutput.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import { css } from '@emotion/core';
-
-const TOKENS = /{([a-z]+)}(.*?(?={|$))/g;
-
-const ShellOutput = ({ line }) => (
-