DeepLink feedback
This commit is contained in:
20
src/core/components/deep-link.jsx
Normal file
20
src/core/components/deep-link.jsx
Normal 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
|
||||
@@ -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
|
||||
@@ -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} />
|
||||
|
||||
@@ -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} />
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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}`} />
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user