1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

fix TOC item clicks, dim deprecated items, minimal deprecated entities

This commit is contained in:
Matthias Kretschmann 2019-01-28 13:42:50 +01:00
parent 16b0a2270f
commit ad1fded323
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 31 additions and 16 deletions

View File

@ -148,3 +148,9 @@
border-left-color: $green; border-left-color: $green;
} }
} }
[data-deprecated='true'] {
code {
opacity: .5;
}
}

View File

@ -145,13 +145,9 @@ const PropertyWrapper = ({ property, sourceUrl, parentAnchor }) => {
className={styles.property} className={styles.property}
data-private={!isPublic} data-private={!isPublic}
data-deprecated={!!deprecation} data-deprecated={!!deprecation}
id={`${parentAnchor}-${slugify(name)}`}
> >
<h3 <h3 className={styles.propertyName}>{name}</h3>
id={`${parentAnchor}-${slugify(name)}`}
className={styles.propertyName}
>
{name}
</h3>
<div <div
className={styles.propertyType} className={styles.propertyType}
@ -167,7 +163,7 @@ const PropertyWrapper = ({ property, sourceUrl, parentAnchor }) => {
</div> </div>
)} )}
{comment && ( {comment && !deprecation && (
<div className={styles.propertyDescription}> <div className={styles.propertyDescription}>
{comment.text || comment.shortText} {comment.text || comment.shortText}
</div> </div>

View File

@ -32,6 +32,10 @@
opacity: .5; opacity: .5;
} }
code {
opacity: 1;
}
.sourceLink { .sourceLink {
display: none; display: none;
} }
@ -107,10 +111,10 @@
.deprecation { .deprecation {
font-size: $font-size-small; font-size: $font-size-small;
margin-bottom: $spacer / 4; margin-top: $spacer / 4;
strong { strong {
color: $red; color: $brand-grey-light;
} }
} }

View File

@ -11,13 +11,22 @@ export default class Toc extends PureComponent {
} }
subItems = (children, parentName) => subItems = (children, parentName) =>
children.filter(filterByKindOfProperty).map(({ name }) => ( children.filter(filterByKindOfProperty).map(({ name, decorators }) => {
<li key={name}> const deprecation = (decorators || []).filter(
<a href={`#${parentName}-${slugify(name)}`}> ({ name }) => name === 'deprecated'
<code>{name}</code> )[0] // Assuming deprecated annotation
</a>
</li> return (
)) <li key={name}>
<a
data-deprecated={!!deprecation}
href={`#${parentName}-${slugify(name)}`}
>
<code>{name}</code>
</a>
</li>
)
})
items = this.props.data.map(({ name, children }) => { items = this.props.data.map(({ name, children }) => {
let subIds = [] let subIds = []