summaryrefslogtreecommitdiff
path: root/web-ui/src/common/back_link/back_link.js
diff options
context:
space:
mode:
authorAnike Arni <aarni@thoughtworks.com>2017-03-29 17:10:19 -0300
committerAnike Arni <aarni@thoughtworks.com>2017-03-30 15:10:57 -0300
commit9a2a9cf5f4d13e2bc9bb0bd997ecd22ec5241b4b (patch)
tree70e5175f723e9940eeb83373c1a41a9fc01e4fd9 /web-ui/src/common/back_link/back_link.js
parent26cb72e514a51d571e13dfd74e99f6b2499efe22 (diff)
[#932] Makes back link a button
Diffstat (limited to 'web-ui/src/common/back_link/back_link.js')
-rw-r--r--web-ui/src/common/back_link/back_link.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/web-ui/src/common/back_link/back_link.js b/web-ui/src/common/back_link/back_link.js
index f3bdb2b5..bb5ffbea 100644
--- a/web-ui/src/common/back_link/back_link.js
+++ b/web-ui/src/common/back_link/back_link.js
@@ -19,12 +19,19 @@ import React from 'react';
import './back_link.scss';
+const icon = <i className='fa fa-angle-left' aria-hidden='true' />;
+
+const button = (text, options) => (
+ <button className='link' {...options}>{icon}<span>{text}</span></button>
+);
+
+const link = (text, options) => (
+ <a className='link' {...options}>{icon}<span>{text}</span></a>
+);
+
const BackLink = ({ text, ...other }) => (
<div className='link-content'>
- <a className='link' tabIndex='0' {...other}>
- <i className='fa fa-angle-left' aria-hidden='true' />
- <span>{text}</span>
- </a>
+ { other.href ? link(text, other) : button(text, other) }
</div>
);