-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Innovation week: Updated tutorial experience #855
Merged
Merged
Changes from 133 commits
Commits
Show all changes
134 commits
Select commit
Hold shift + click to select a range
ded7ed2
chore: add helpers for determining if element is a code block
jerelmiller 211d8c9
chore: add warning package
jerelmiller 5d0fdc6
feat: Add a Tutorial component that will flip between files and their…
jerelmiller 1095bd1
feat: add ability to specify project. Update MDX to use code
jerelmiller ed33c14
chore: more robust handling of finding previous step
jerelmiller c484371
feat: highlight lines that are new
jerelmiller ed3444c
feat: handle proper diffing on each step
jerelmiller 6499557
chore: add tutorial section
jerelmiller 71992f2
chore: handle parsing code blocks inside sections
jerelmiller 13df919
chore: update prop types on tutorial step
jerelmiller f96033c
feat: gather steps inside tutorial sections
jerelmiller ce1c9a2
chore: check if file name is present in project config
jerelmiller b29e34a
chore: update guide to use sections
jerelmiller 2617b55
chore: update spacing on section/step elements
jerelmiller d86a8cd
chore: dont highlight empty lines when they start a change
jerelmiller 14b24fd
chore: update tutorial to use correct code
jerelmiller 9ac661c
chore: add validation on children
jerelmiller 82334ac
chore: handle pure tutorial steps
jerelmiller 9cc58b1
feat: create a Terminal component
jerelmiller ca27f28
feat: create custom code block that renders a terminal for shell lang…
jerelmiller 08afb77
chore: move Terminal into subfolder
jerelmiller d71b44d
feat: add syntax highlighting to terminal commands
jerelmiller ecbf261
chore: create a cursor
jerelmiller 1fa4ff4
chore: reorg some components in the terminal
jerelmiller c5241bb
chore: roll up lines into commands
jerelmiller 0ed5a72
feat: add output coloring for each output line
jerelmiller abd2666
chore: handle blank output lines
jerelmiller 4ed4867
fix: only copy non-output lines
jerelmiller 180b456
chore: remove empty lines
jerelmiller 6965354
chore: use implicit return
jerelmiller 9482d11
refactor: move syntax highlighter inline
jerelmiller 1b1fa11
refactor: aggregate command into own component
jerelmiller 87c92e4
refactor: move shell ui into shell component
jerelmiller 3782543
feat: show cursor on terminal prompts
jerelmiller 87c406f
chore: install react-typist
jerelmiller 67e1243
chore: show staggered output and commands
jerelmiller 9261284
chore: add ability to turn off animations
jerelmiller 2ac0849
chore: install patch-package
jerelmiller 1c45144
chore: add patch to allow custom cursor
jerelmiller 5ff7d9d
chore: add support for hiding cursor when done
jerelmiller 64fc3df
chore: partway there for typed commands
jerelmiller 832ea67
chore: only show output when finished typing
jerelmiller 06aeed5
chore: fix done early. dont type when not animating
jerelmiller 0d248f9
chore: refactor to use xstate to simplify state logic
jerelmiller 5d66db4
chore: better typing delay for commands that aren't the first
jerelmiller 458ca8a
feat: animate output for nerdpack create command
jerelmiller bb859ef
chore: augmented output timing. handle static terminal output
jerelmiller 645920c
chore: add output for nerdpack serve command
jerelmiller 29452de
chore: measure height of the shell before animating it
jerelmiller 14926a3
chore: better cursor sizing to avoid lines from resizing
jerelmiller 90d315a
chore: ensure cursor is shown on empty state
jerelmiller 83a2a7b
chore: dont show cursor for non-animated terminals
jerelmiller 8a767a7
chore: tokenize in shell output component
jerelmiller e13c8fe
feat: start animation when user scrolls the terminal into view
jerelmiller d0d5e44
chore: allow text to wrap
jerelmiller cb9db73
chore: create tutorial editor in tutorial instead of step component
jerelmiller 1d52bca
refactor: update props that are received by the tutorial editor
jerelmiller 34584b5
refactor: rename functions for clarity
jerelmiller a2adbbc
chore: get project config from all code blocks with file names
jerelmiller da4a75b
chore: remove warnings about missing file name and language
jerelmiller 3291690
chore: move helper inline
jerelmiller 2d25989
chore: remove warning about code block
jerelmiller 2fa5b9e
chore: remove unneeded helpers
jerelmiller 8ccd284
chore: pass parent when visiting
jerelmiller 3beeeb8
refactor: replace deeply nested code blocks with tutorial editor
jerelmiller 74b219e
refactor: move children utils to own file
jerelmiller ee58f46
fix: add back step counter within a tutorial section
jerelmiller c94fdec
fix: upgrade gatsby theme newrelic
jerelmiller 5cba805
chore: rename function for clarity
jerelmiller e3e455e
chore: parse title from children instead of prop
jerelmiller afecfbb
chore: support light mode for the tutorial editor
jerelmiller 49c9370
chore: use cloneElement on title
jerelmiller 9503d72
chore: execute timeout immediately if the next line is empty
jerelmiller b88294a
chore: add a bottom dividier line on the last step
jerelmiller fc12370
chore: handle blank line differently
jerelmiller 87e359a
chore: keep single child if there is an only child
jerelmiller 611cc08
chore: add mdxType to tutorial editor
jerelmiller 99d5433
chore: add spacing on tutorial editors
jerelmiller 485f7fb
chore: rename function for clarity
jerelmiller ea59e64
chore: slight style update on step counter
jerelmiller 044aad2
chore: update some styles for better spacing
jerelmiller 2c4b971
chore: remove spacing for now
jerelmiller 039b040
chore: remove top margin from lists
jerelmiller 271969b
chore: show code blocks in right column
jerelmiller 076b99a
chore: only associate previous element with code block
jerelmiller f46abd2
refactor: minor cleanup
jerelmiller d972366
chore: move helpers to bottom
jerelmiller f98ac49
chore: slight change in spacing
jerelmiller 995d275
chore: add mobile breakpoint for tutorial step
jerelmiller 963ad86
docs: move first step back into tutorial
jerelmiller 1cbdb96
refactor: move children up
jerelmiller cea9ba4
chore: move typist up to command line
jerelmiller 5420527
chore: fix empty line size
jerelmiller acf31bb
refactor: use xstate to determine shell state
jerelmiller 4c067fa
chore: reduce typing delay for first command
jerelmiller b2479aa
chore: update guide to match prod
jerelmiller 084bbdd
chore: add copy icon to copy button on terminal
jerelmiller 4bf65fc
chore: tweak cursor speak and scroll point
jerelmiller 582b6d8
chore: Steps/Step use tutorial components
jerelmiller 9ca5120
chore: tell amplify to use node 12
jerelmiller ded3b3b
chore: comment out unused components
jerelmiller d6dc82f
chore: specify node 12
jerelmiller 6eeff3f
Merge remote-tracking branch 'origin/develop' into jerel/apple-style-…
jerelmiller 284b09e
chore: dont wrap terminal commands
jerelmiller 47eae17
fix: upgrade @xstate/react
jerelmiller fd2460c
chore: allow several heading levels on tutorial step
jerelmiller 51bd189
chore: remove commented import of step(s) components
jerelmiller 470cae9
chore: remove step(s) components
jerelmiller 384ec34
chore: use old naming on map pageviews by region
jerelmiller e23f339
chore: extract AnimatedCommand to own file
jerelmiller d2825a4
chore: extract StaticCommand to own file
jerelmiller 7c01bb5
chore: remove unneeded comment
jerelmiller 24d733f
chore: fix file path of StaticCommand
jerelmiller 43bc6df
refactor: flatten lines and create new machine
jerelmiller 7b4354f
chore: handle timeouts between shell output
jerelmiller 0fb051d
chore: smaller timeout on output
jerelmiller c677638
chore: move timeout logic into spawned actor
jerelmiller 6fbca75
chore: fix prompt. Better typing delay between commands. Fix multiple…
jerelmiller 98eafe4
chore: smaller timeout on output
jerelmiller 9eeaa3a
chore: get rid of old command components
jerelmiller 4bcc012
refactor: extract menu bar into own component
jerelmiller ff738fc
chore: move most of the UI into the shell component
jerelmiller 6056109
chore: add back copy button
jerelmiller d9c594e
chore: allow terminal to be configured as copyable
jerelmiller 519bd5c
chore: filter out comments from copyable output
jerelmiller f6fe48e
chore: update comment
jerelmiller 05d2c83
chore: remove frame button from the terminal component
jerelmiller ee8c5ea
chore: rename guard to test
jerelmiller ce4618b
chore: add the ability to wrap the terminal commands
jerelmiller cfedf24
Merge remote-tracking branch 'origin/develop' into jerel/apple-style-…
jerelmiller 91f6a75
Revert "chore: add the ability to wrap the terminal commands"
jerelmiller 231cfd3
Merge branch 'develop' into jerel/apple-style-tutorial
jerelmiller 142dda9
fix: upgrade gatsby-theme-newrelic
jerelmiller a4f2d70
Merge branch 'develop' into jerel/apple-style-tutorial
jerelmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is awesome |
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of the new names. Would love to get some help on naming these components. We've received feedback that
Steps
andStep
are too similar and hard to follow. The old names are aliased above, but I'd love to figure out a better name for this component.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been really thinking about this and I still do not know what you could rename it to. I am terrible with names.