DeepLink feedback

This commit is contained in:
Greg Thompson
2017-12-11 14:27:28 -06:00
parent 05fd5b354d
commit d2e931f3e1
6 changed files with 30 additions and 30 deletions

View File

@@ -0,0 +1,20 @@
import React from "react"
import PropTypes from "prop-types"
export const DeepLink = ({ enabled, path, text }) => {
return (
<a className="nostyle"
onClick={enabled ? (e) => e.preventDefault() : null}
href={enabled ? `#/${path}` : null}>
<span>{text}</span>
</a>
)
}
DeepLink.propTypes = {
enabled: PropTypes.bool,
isShown: PropTypes.bool,
path: PropTypes.string,
text: PropTypes.string
}
export default DeepLink

View File

@@ -1,20 +0,0 @@
import React from "react"
import PropTypes from "prop-types"
export const DeepLinkingLink = ({ isDeepLinkingEnabled, path, text }) => {
return (
<a className="nostyle"
onClick={isDeepLinkingEnabled ? (e) => e.preventDefault() : null}
href={isDeepLinkingEnabled ? `#/${path}` : null}>
<span>{text}</span>
</a>
)
}
DeepLinkingLink.propTypes = {
isDeepLinkingEnabled: PropTypes.bool,
isShown: PropTypes.bool,
path: PropTypes.string,
text: PropTypes.string
}
export default DeepLinkingLink

View File

@@ -101,7 +101,7 @@ export default class Operation extends PureComponent {
const Schemes = getComponent( "schemes" )
const OperationServers = getComponent( "OperationServers" )
const OperationExt = getComponent( "OperationExt" )
const DeepLinkingLink = getComponent( "DeepLinkingLink" )
const DeepLink = getComponent( "DeepLink" )
const { showExtensions } = getConfigs()
@@ -120,8 +120,8 @@ export default class Operation extends PureComponent {
<div className={deprecated ? "opblock opblock-deprecated" : isShown ? `opblock opblock-${method} is-open` : `opblock opblock-${method}`} id={isShownKey.join("-")} >
<span className="opblock-summary-method">{method.toUpperCase()}</span>
<span className={ deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path" } >
<DeepLinkingLink
isDeepLinkingEnabled={isDeepLinkingEnabled}
<DeepLink
enabled={isDeepLinkingEnabled}
isShown={isShown}
path={`${isShownKey.join("/")}`}
text={path} />

View File

@@ -37,7 +37,7 @@ export default class Operations extends React.Component {
const OperationContainer = getComponent("OperationContainer", true)
const Collapse = getComponent("Collapse")
const Markdown = getComponent("Markdown")
const DeepLinkingLink = getComponent("DeepLinkingLink")
const DeepLink = getComponent("DeepLink")
let {
docExpansion,
@@ -80,8 +80,8 @@ export default class Operations extends React.Component {
onClick={() => layoutActions.show(isShownKey, !showTag)}
className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag" }
id={isShownKey.join("-")}>
<DeepLinkingLink
isDeepLinkingEnabled={isDeepLinkingEnabled}
<DeepLink
enabled={isDeepLinkingEnabled}
isShown={showTag}
path={tag}
text={tag} />

View File

@@ -61,7 +61,7 @@ import PrimitiveModel from "core/components/primitive-model"
import Property from "core/components/property"
import TryItOutButton from "core/components/try-it-out-button"
import VersionStamp from "core/components/version-stamp"
import DeepLinkingLink from "core/components/deeplinking-link"
import DeepLink from "core/components/deep-link"
import Markdown from "core/components/providers/markdown"
@@ -123,7 +123,7 @@ export default function() {
OperationExtRow,
ParameterExt,
OperationContainer,
DeepLinkingLink
DeepLink
}
}

View File

@@ -3,13 +3,13 @@ import React from "react"
import expect, { createSpy } from "expect"
import { render } from "enzyme"
import { fromJS } from "immutable"
import DeepLinkingLink from "components/deeplinking-link"
import DeepLink from "components/deep-link"
import Operations from "components/operations"
import {Collapse} from "components/layout-utils"
const components = {
Collapse,
DeepLinkingLink,
DeepLink,
OperationContainer: ({ path, method }) => <span className="mocked-op" id={`${path}-${method}`} />
}