-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #855 from newrelic/jerel/apple-style-tutorial
Innovation week: Updated tutorial experience
- Loading branch information
Showing
31 changed files
with
2,329 additions
and
1,709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/@newrelic/gatsby-theme-newrelic/components/CodeBlock.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import CodeBlock from '@newrelic/gatsby-theme-newrelic/src/components/CodeBlock'; | ||
import Terminal from '../../../components/Terminal'; | ||
import { isShellLanguage } from '../../../utils/codeBlock'; | ||
|
||
const CustomCodeBlock = ({ | ||
language, | ||
children, | ||
animate, | ||
copyable, | ||
...props | ||
}) => { | ||
return isShellLanguage(language) ? ( | ||
<Terminal animate={animate} copyable={copyable}> | ||
{children} | ||
</Terminal> | ||
) : ( | ||
<CodeBlock language={language} copyable={copyable} {...props}> | ||
{children} | ||
</CodeBlock> | ||
); | ||
}; | ||
|
||
CustomCodeBlock.propTypes = CodeBlock.propTypes; | ||
|
||
export default CustomCodeBlock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Does not render. Will be used by the `Tutorial` component | ||
const Project = () => { | ||
return null; | ||
}; | ||
|
||
export default Project; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { css, keyframes } from '@emotion/core'; | ||
import Prompt from './Prompt'; | ||
import Typist from 'react-typist'; | ||
|
||
const blink = keyframes` | ||
0%, 49% { | ||
background: #c0c5ce; | ||
} | ||
50%, 100% { | ||
background: none; | ||
} | ||
`; | ||
|
||
const CommandLine = ({ | ||
animate, | ||
avgTypingDelay, | ||
cursor, | ||
children, | ||
prompt, | ||
typingDelay, | ||
onFinishedTyping, | ||
}) => { | ||
const element = animate ? ( | ||
<Typist | ||
startDelay={typingDelay} | ||
avgTypingDelay={avgTypingDelay} | ||
cursor={{ show: false }} | ||
onTypingDone={onFinishedTyping} | ||
css={css` | ||
&:empty { | ||
display: inline-block; | ||
} | ||
`} | ||
> | ||
{children} | ||
</Typist> | ||
) : ( | ||
children | ||
); | ||
|
||
return ( | ||
<div | ||
css={css` | ||
display: grid; | ||
grid-template-columns: 1ch auto; | ||
grid-gap: 1ch; | ||
justify-content: start; | ||
align-items: baseline; | ||
`} | ||
> | ||
<Prompt character={prompt} /> | ||
<div | ||
css={css` | ||
position: relative; | ||
color: #fafafa; | ||
white-space: pre; | ||
&:empty { | ||
height: 100%; | ||
} | ||
${cursor && | ||
css` | ||
&:after { | ||
content: ''; | ||
display: block; | ||
width: 1ch; | ||
height: 1.25em; | ||
animation: ${blink} 1.25s infinite; | ||
position: absolute; | ||
top: 1px; | ||
right: -1ch; | ||
} | ||
`}; | ||
`} | ||
> | ||
{element} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
CommandLine.propTypes = { | ||
animate: PropTypes.bool, | ||
avgTypingDelay: PropTypes.number, | ||
children: PropTypes.node, | ||
cursor: PropTypes.bool, | ||
prompt: PropTypes.oneOf(['$', '>']), | ||
typingDelay: PropTypes.number, | ||
onFinishedTyping: PropTypes.func, | ||
}; | ||
|
||
CommandLine.defaultProps = { | ||
animate: false, | ||
avgTypingDelay: 40, | ||
typingDelay: 0, | ||
}; | ||
|
||
export default CommandLine; |
Oops, something went wrong.