add presentational component to allow for wrapping deeplinking links

This commit is contained in:
Greg Thompson
2017-12-01 14:30:37 -06:00
parent 0256b97855
commit 0b8cd7e32f
4 changed files with 32 additions and 13 deletions

View File

@@ -0,0 +1,19 @@
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.boolean,
path: PropTypes.string,
text: PropTypes.string
}
export default DeepLinkingLink