1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-06-28 00:27:59 +02:00

nicer source link

This commit is contained in:
Matthias Kretschmann 2019-01-22 14:23:53 +01:00
parent c6b9cbb59e
commit 0caf03e24e
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 27 additions and 16 deletions

View File

@ -162,7 +162,9 @@ const PropertyWrapper = ({ property, sourceUrl, parentAnchor }) => {
if (deprecation) {
deprecatedUse = deprecation.arguments.alternative.replace(/'/g, '')
}
const sourceLink = `${sourceUrl}${fileName}#L${line}`
return (
<div
id={`${parentAnchor}/${slugify(name)}`}
@ -186,17 +188,6 @@ const PropertyWrapper = ({ property, sourceUrl, parentAnchor }) => {
</div>
)}
{fileName && (
<a
className={styles.sourceLink}
href={sourceLink}
target="_blank"
rel="noopener noreferrer"
>
source
</a>
)}
{comment && (
<div className={styles.propertyDescription}>
{comment.text || comment.shortText}
@ -223,6 +214,17 @@ const PropertyWrapper = ({ property, sourceUrl, parentAnchor }) => {
return <PropertyDetails property={property} />
}
})()}
{fileName && (
<a
className={styles.sourceLink}
href={sourceLink}
target="_blank"
rel="noopener noreferrer"
>
{`${fileName}#L${line}`}
</a>
)}
</div>
)
}

View File

@ -91,13 +91,22 @@
}
.sourceLink {
position: absolute;
bottom: $spacer / 2;
right: $spacer / 2;
display: block;
font-size: $font-size-mini;
font-family: $font-family-button;
text-transform: uppercase;
color: $brand-grey-light;
margin-top: $spacer / 2;
&:hover,
&:focus {
transform: none;
}
@media (min-width: $break-point--large) {
margin-top: 0;
position: absolute;
bottom: $spacer / 2;
right: $spacer / 2;
}
}
.deprecation {