mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
fix unique keys
This commit is contained in:
parent
3e40c3d078
commit
dad281d32c
@ -62,6 +62,7 @@
|
|||||||
"remark": "^11.0.1",
|
"remark": "^11.0.1",
|
||||||
"remark-github-plugin": "^1.3.1",
|
"remark-github-plugin": "^1.3.1",
|
||||||
"remark-react": "^6.0.0",
|
"remark-react": "^6.0.0",
|
||||||
|
"shortid": "^2.2.15",
|
||||||
"slugify": "^1.3.4",
|
"slugify": "^1.3.4",
|
||||||
"smoothscroll-polyfill": "^0.4.4",
|
"smoothscroll-polyfill": "^0.4.4",
|
||||||
"swagger-client": "^3.9.5"
|
"swagger-client": "^3.9.5"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import slugify from 'slugify'
|
import slugify from 'slugify'
|
||||||
|
import shortid from 'shortid'
|
||||||
import Scroll from '../../components/Scroll'
|
import Scroll from '../../components/Scroll'
|
||||||
import styles from './Entities.module.scss'
|
import styles from './Entities.module.scss'
|
||||||
import { filterByKindOfProperty } from './utils'
|
import { filterByKindOfProperty } from './utils'
|
||||||
@ -34,13 +35,13 @@ const Type = ({ type }) => {
|
|||||||
<span className={styles.typeSymbol}><</span>
|
<span className={styles.typeSymbol}><</span>
|
||||||
<span>
|
<span>
|
||||||
{typeArguments.map((typeArgument, i) => (
|
{typeArguments.map((typeArgument, i) => (
|
||||||
<span key={i}>
|
<span key={shortid.generate()}>
|
||||||
{i !== 0 && (
|
{i !== 0 && (
|
||||||
<span className={styles.typeSymbol}>
|
<span className={styles.typeSymbol}>
|
||||||
,{' '}
|
,{' '}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<Type type={typeArgument} key={i} />
|
<Type type={typeArgument} />
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</span>
|
</span>
|
||||||
@ -88,7 +89,7 @@ const MethodDetails = ({ property }) => {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={styles.parameters}
|
className={styles.parameters}
|
||||||
key={parameter.name}
|
key={shortid.generate()}
|
||||||
>
|
>
|
||||||
<h5>
|
<h5>
|
||||||
<code>{name}</code>
|
<code>{name}</code>
|
||||||
@ -227,7 +228,7 @@ PropertyWrapper.propTypes = {
|
|||||||
|
|
||||||
const Entities = ({ entities, sourceUrl }) =>
|
const Entities = ({ entities, sourceUrl }) =>
|
||||||
entities.map(({ name, comment, children }) => (
|
entities.map(({ name, comment, children }) => (
|
||||||
<div key={name} id={name && slugify(name)}>
|
<div key={shortid.generate()} id={name && slugify(name)}>
|
||||||
<h2 className={styles.entityName}>
|
<h2 className={styles.entityName}>
|
||||||
<code>{name}</code>
|
<code>{name}</code>
|
||||||
</h2>
|
</h2>
|
||||||
@ -243,7 +244,7 @@ const Entities = ({ entities, sourceUrl }) =>
|
|||||||
.filter(filterByKindOfProperty)
|
.filter(filterByKindOfProperty)
|
||||||
.map(property => (
|
.map(property => (
|
||||||
<PropertyWrapper
|
<PropertyWrapper
|
||||||
key={`${name}/${property.id}`}
|
key={shortid.generate()}
|
||||||
property={property}
|
property={property}
|
||||||
sourceUrl={sourceUrl}
|
sourceUrl={sourceUrl}
|
||||||
parentAnchor={name && slugify(name)}
|
parentAnchor={name && slugify(name)}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react'
|
import React, { PureComponent } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import slugify from 'slugify'
|
import slugify from 'slugify'
|
||||||
|
import shortid from 'shortid'
|
||||||
import Scrollspy from 'react-scrollspy'
|
import Scrollspy from 'react-scrollspy'
|
||||||
import Scroll from '../../components/Scroll'
|
import Scroll from '../../components/Scroll'
|
||||||
import { filterByKindOfProperty } from './utils'
|
import { filterByKindOfProperty } from './utils'
|
||||||
@ -19,7 +20,7 @@ export default class Toc extends PureComponent {
|
|||||||
)[0] // Assuming deprecated annotation
|
)[0] // Assuming deprecated annotation
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li key={name}>
|
<li key={shortid.generate()}>
|
||||||
<Scroll
|
<Scroll
|
||||||
type="id"
|
type="id"
|
||||||
element={`${parentName}-${name && slugify(name)}`}
|
element={`${parentName}-${name && slugify(name)}`}
|
||||||
@ -44,7 +45,7 @@ export default class Toc extends PureComponent {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li key={name}>
|
<li key={shortid.generate()}>
|
||||||
<Scroll
|
<Scroll
|
||||||
type="id"
|
type="id"
|
||||||
element={`${name && slugify(name)}`}
|
element={`${name && slugify(name)}`}
|
||||||
|
Loading…
Reference in New Issue
Block a user