From 9cc58b16b824d9215f09321835cd85edd5cad5bd Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Wed, 14 Oct 2020 15:13:59 -0700 Subject: [PATCH] feat: create a Terminal component --- src/components/Terminal.js | 119 +++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 src/components/Terminal.js diff --git a/src/components/Terminal.js b/src/components/Terminal.js new file mode 100644 index 000000000..56e8f3a42 --- /dev/null +++ b/src/components/Terminal.js @@ -0,0 +1,119 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { css } from '@emotion/core'; +import { Button, useClipboard } from '@newrelic/gatsby-theme-newrelic'; + +const FrameButton = ({ color }) => ( +
+); + +FrameButton.propTypes = { + color: PropTypes.string, +}; + +const Terminal = ({ children }) => { + const [copied, copy] = useClipboard(); + + return ( +
+
+ + + +
+ bash +
+ + +
+
+ {children + .trim() + .split('\n') + .map((line, idx) => ( +
+ + $ + +
+ {line} +
+
+ ))} +
+
+ ); +}; + +Terminal.propTypes = { + children: PropTypes.string, +}; + +export default Terminal;