1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-07-01 06:02:10 +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) { if (deprecation) {
deprecatedUse = deprecation.arguments.alternative.replace(/'/g, '') deprecatedUse = deprecation.arguments.alternative.replace(/'/g, '')
} }
const sourceLink = `${sourceUrl}${fileName}#L${line}` const sourceLink = `${sourceUrl}${fileName}#L${line}`
return ( return (
<div <div
id={`${parentAnchor}/${slugify(name)}`} id={`${parentAnchor}/${slugify(name)}`}
@ -186,17 +188,6 @@ const PropertyWrapper = ({ property, sourceUrl, parentAnchor }) => {
</div> </div>
)} )}
{fileName && (
<a
className={styles.sourceLink}
href={sourceLink}
target="_blank"
rel="noopener noreferrer"
>
source
</a>
)}
{comment && ( {comment && (
<div className={styles.propertyDescription}> <div className={styles.propertyDescription}>
{comment.text || comment.shortText} {comment.text || comment.shortText}
@ -223,6 +214,17 @@ const PropertyWrapper = ({ property, sourceUrl, parentAnchor }) => {
return <PropertyDetails property={property} /> return <PropertyDetails property={property} />
} }
})()} })()}
{fileName && (
<a
className={styles.sourceLink}
href={sourceLink}
target="_blank"
rel="noopener noreferrer"
>
{`${fileName}#L${line}`}
</a>
)}
</div> </div>
) )
} }

View File

@ -91,13 +91,22 @@
} }
.sourceLink { .sourceLink {
position: absolute; display: block;
bottom: $spacer / 2;
right: $spacer / 2;
font-size: $font-size-mini; font-size: $font-size-mini;
font-family: $font-family-button;
text-transform: uppercase;
color: $brand-grey-light; 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 { .deprecation {