-
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 branch 'master' into jerel/css-modules
- Loading branch information
Showing
13 changed files
with
265 additions
and
28 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,13 @@ | ||
import React from 'react'; | ||
import styles from './Intro.module.scss'; | ||
import Proptypes from 'prop-types'; | ||
|
||
const Intro = ({ children }) => ( | ||
<div className={styles.container}>{children}</div> | ||
); | ||
|
||
Intro.propTypes = { | ||
children: Proptypes.node.isRequired, | ||
}; | ||
|
||
export default Intro; |
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,14 @@ | ||
.container { | ||
display: flex; | ||
p { | ||
width: 50%; | ||
color: var(--color-neutrals-600); | ||
font-size: 1.125rem; | ||
line-height: 2rem; | ||
margin-right: 1rem; | ||
} | ||
div { | ||
width: 50%; | ||
margin-left: 1rem; | ||
} | ||
} |
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,27 @@ | ||
import React from 'react'; | ||
import styles from './Step.module.scss'; | ||
import Proptypes from 'prop-types'; | ||
|
||
const Step = ({ children, number, total }) => { | ||
const codeSnippet = children.find((child) => child?.props?.mdxType === 'pre'); | ||
const childrenWithoutCodeSnippet = children.filter( | ||
(child) => child !== codeSnippet | ||
); | ||
return ( | ||
<div className={styles.wrapper}> | ||
<p className={styles.stepNumber}>{`Step ${number} of ${total}`}</p> | ||
<div className={styles.container}> | ||
<div className={styles.stepDetails}>{childrenWithoutCodeSnippet}</div> | ||
{codeSnippet} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
Step.propTypes = { | ||
children: Proptypes.node.isRequired, | ||
number: Proptypes.number.isRequired, | ||
total: Proptypes.number.isRequired, | ||
}; | ||
|
||
export default Step; |
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,34 @@ | ||
.wrapper { | ||
border-top: solid 1px var(--color-neutrals-100); | ||
box-sizing: border-box; | ||
padding-top: 1.5rem; | ||
margin-top: 2rem; | ||
.stepNumber { | ||
font-size: 0.75rem; | ||
color: var(--color-neutrals-600); | ||
} | ||
} | ||
.container { | ||
display: flex; | ||
} | ||
.stepDetails { | ||
margin-right: 1rem; | ||
width: 50%; | ||
line-height: 1.5rem; | ||
h1:first-child, | ||
h2:first-child, | ||
h3:first-child, | ||
h4:first-child, | ||
h5:first-child, | ||
h6:first-child { | ||
color: var(--color-neutrals-900); | ||
font-weight: bold; | ||
margin-top: 0.5rem; | ||
margin-bottom: 1rem; | ||
font-size: 1rem; | ||
} | ||
} | ||
.container > pre { | ||
width: 50%; | ||
margin-left: 1rem; | ||
} |
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,29 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const Steps = ({ children }) => { | ||
// get the number of steps | ||
const totalSteps = children.filter( | ||
(child) => child?.props?.mdxType === 'Step' | ||
).length; | ||
|
||
// return the children with additional props | ||
return ( | ||
<> | ||
{children.map((child, index) => ({ | ||
...child, | ||
props: { | ||
...child.props, | ||
number: index + 1, | ||
total: totalSteps, | ||
}, | ||
}))} | ||
</> | ||
); | ||
}; | ||
|
||
Steps.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
}; | ||
|
||
export default Steps; |
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 |
---|---|---|
@@ -1,29 +1,88 @@ | ||
--- | ||
path: '/guides/graphql-api' | ||
path: '/guides/example' | ||
duration: '30 min' | ||
title: 'GraphQL API' | ||
title: 'Example Guide' | ||
template: 'GuideTemplate' | ||
description: 'Example guide page' | ||
--- | ||
|
||
## Lorem ipsum | ||
<Intro> | ||
|
||
![image](../images/NewRelic-logo.png) | ||
This guide steps you through adding access to the New Relic time picker to a sample transaction overview application. You also add the selected time to the queries used in the application’s chart components. Start by setting up the sample application and running it locally. Then add the time picker, and some time picker features. | ||
|
||
Integer aliquam convallis scelerisque. Donec auctor dictum viverra. Praesent commodo porttitor tortor. Fusce eget sem arcu. Praesent convallis augue est. `Vestibulum` in mi sollicitudin, rhoncus est eu, rutrum augue. Ut in elit ac odio ultrices pharetra eget id magna. Donec tellus dui, volutpat ut malesuada eget, pharetra eget metus. Proin tortor lacus, vestibulum dignissim urna ac, rutrum vulputate orci. Sed justo tellus, convallis eu tincidunt at, euismod eu enim. Sed interdum viverra volutpat. Suspendisse eget accumsan nunc. Aliquam tempor in magna ut lobortis. | ||
<Video id="zxunt1u1as" type="wistia"/> | ||
</Intro> | ||
|
||
This guide requires that you have the following: | ||
|
||
- A github account | ||
- New Relic developer account | ||
- API Key | ||
- New Relic One CLI downloaded | ||
|
||
<br/> | ||
|
||
### Set up the sample application | ||
|
||
You can use this application for trying things out. Or, skip this section and start with "Add time picker" below, if you just want to add the time picker to an existing applicaiton. | ||
|
||
<Steps> | ||
|
||
<Step> | ||
|
||
## Clone the example application | ||
This repo contains an example application and code that supports a handful of how to guides for cool and useful features you migth want in your applications. If you've tried other how to guides, you might have already cloned this repo, in which case, you should probably go ahead and update from master. | ||
|
||
```shell lineNumbers=false | ||
git clone https://github.com/newrelic/nr1-how-to.git | ||
``` | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
## Set up and run the application locally | ||
Use the New Relic One CLI to update the application UUID and run the application locally. In the terminal, change to the time picker directory. | ||
|
||
```shell lineNumbers=false | ||
cd /nr1-howto/add-time-picker | ||
``` | ||
</Step> | ||
|
||
<Step> | ||
|
||
## Make sure you're getting data from the right New Relic account | ||
In your preferred text editor, open the `/add-time-picker/nerdlets/nr1-howto-add-time-picker-nerdlet/index.js` and then edit the following line to use your account ID (find your account ID in the Profile section of the Developer Center, where you downloaded the New Relic One CLI): | ||
|
||
```jsx | ||
import React from 'react'; | ||
this.accountId = <REPLACE ME WITH YOUR ACCOUNT ID>; | ||
``` | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
const FooBar = () => ( | ||
<div>Hello, World!</div> | ||
); | ||
Update the UUID and serve the application by running the following: | ||
|
||
export default FooBar; | ||
```shell lineNumbers=false | ||
nr1 nerdpack:uuid -gf | ||
nr1 nerdpack:serve | ||
``` | ||
|
||
Integer aliquam convallis scelerisque. Donec auctor dictum viverra. Praesent commodo porttitor tortor. Fusce eget sem arcu. Praesent convallis augue est. `Vestibulum` in mi sollicitudin, rhoncus est eu, rutrum augue. Ut in elit ac odio ultrices pharetra eget id magna. Donec tellus dui, volutpat ut malesuada eget, pharetra eget metus. Proin tortor lacus, vestibulum dignissim urna ac, rutrum vulputate orci. Sed justo tellus, convallis eu tincidunt at, euismod eu enim. Sed interdum viverra volutpat. Suspendisse eget accumsan nunc. Aliquam tempor in magna ut lobortis. | ||
</Step> | ||
|
||
<Video id="ZagZfNQYJEU" type="youtube" /> | ||
</Steps> | ||
|
||
<Video id="zxunt1u1as" type="wistia"/> | ||
# Next Steps | ||
|
||
You'll get a URL to access New Relic One and see your application running locally: https://one.newrelic.com/?nerdpacks=local | ||
|
||
One the New Relic home page, there's a new launcher to the Add time picker application. | ||
|
||
Click the launcher, and the dashboard opens with your New Relic account transactions. | ||
|
||
|
||
### Related info | ||
|
||
- [New Relic documentation](https://docs.newrelic.com) | ||
- [Community page for how to add a time picker](https://discuss.newrelic.com/t/how-to-add-the-time-picker-to-nrql-queries/94268) |
Oops, something went wrong.