-
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 #121 from newrelic/cayla/constants
Add constants section
- Loading branch information
Showing
4 changed files
with
85 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import Markdown from 'react-markdown'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './ConstantReference.module.scss'; | ||
|
||
const ConstantReference = ({ constant }) => { | ||
const { name, values, type } = constant; | ||
return ( | ||
<div className={styles.container}> | ||
<div className={styles.name}>{name}</div> | ||
<div>{type === 'array' ? '[' : '{'}</div> | ||
<div className={styles.constantContainer}> | ||
{values.map((value, i) => ( | ||
<Markdown key={i} source={value} /> | ||
))} | ||
</div> | ||
<div>{type === 'array' ? ']' : '}'}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
ConstantReference.propTypes = { | ||
constant: PropTypes.shape({ | ||
type: PropTypes.string, | ||
name: PropTypes.string, | ||
values: PropTypes.array, | ||
}), | ||
}; | ||
|
||
export default ConstantReference; |
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,22 @@ | ||
.container { | ||
color: var(--color-neutrals-500); | ||
font-family: var(--code-font); | ||
font-size: 0.875rem; | ||
line-height: 1.5; | ||
margin-top: 2rem; | ||
} | ||
|
||
.name { | ||
font-size: 1rem; | ||
font-family: var(--primary-font-family); | ||
color: var(--color-neutrals-800); | ||
margin-bottom: 0.5rem; | ||
} | ||
|
||
.block { | ||
margin-left: 0.5rem; | ||
} | ||
|
||
.constantContainer { | ||
margin: 0 0 1rem 1.5rem; | ||
} |
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