-
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.
- Loading branch information
Cayla Hamann
committed
Jun 10, 2020
1 parent
1f08aae
commit 0e770d8
Showing
4 changed files
with
54 additions
and
1 deletion.
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,38 @@ | ||
import React from 'react'; | ||
import Markdown from 'react-markdown'; | ||
import PropTypes from 'prop-types'; | ||
import styles from './TypeDefReference.module.scss'; | ||
|
||
const ConstantReference = ({ constant }) => { | ||
const { name, value } = constant | ||
|
||
const isConstantArray = Array.isArray(value) | ||
console.log(isConstantArray) | ||
|
||
const lines = (!isConstantArray) ? | ||
Object.getOwnPropertyNames(value).map(key=>{ | ||
return `${key}: ${JSON.stringify(value[key])}` | ||
}) : value.map(el => JSON.stringify(el)); | ||
|
||
|
||
return ( | ||
<div className = {styles.container}> | ||
<div className = {styles.name}>{name}</div> | ||
<div>{isConstantArray ? '[': '{'}</div> | ||
<div className= {styles.propertyContainer}> | ||
{lines.map((line,i)=> { | ||
return <Markdown | ||
key={i} | ||
source={line} | ||
/> | ||
}) | ||
} | ||
</div> | ||
<div>{isConstantArray ? '}': ']'}</div> | ||
</div> | ||
) | ||
} | ||
|
||
//render differently based on whether it's an array or object | ||
|
||
export default ConstantReference |
Empty file.
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 |
---|---|---|
|
@@ -61,7 +61,7 @@ const useApiDoc = (name) => { | |
value: api[member] | ||
} | ||
}) | ||
} | ||
}; | ||
|
||
return { | ||
description: apiDocs?.text, | ||
|
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