aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/common
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2016-12-16 10:04:12 +1300
committerGitHub <noreply@github.com>2016-12-16 10:04:12 +1300
commit6b5673e84911f3e2b1599c22c9b4f482a55b9ef1 (patch)
treea6f54fdb9d9be4d6b061a3b30069b330d9325fd5 /web/src/js/components/common
parent78c78ce651478072f3b0a4a7d18f2a8de3147d33 (diff)
parentd854e08653ccee12119266e2cc3f5d6c279341e5 (diff)
downloadmitmproxy-6b5673e84911f3e2b1599c22c9b4f482a55b9ef1.tar.gz
mitmproxy-6b5673e84911f3e2b1599c22c9b4f482a55b9ef1.tar.bz2
mitmproxy-6b5673e84911f3e2b1599c22c9b4f482a55b9ef1.zip
Merge pull request #1845 from mhils/mitmweb-improvements
Mitmweb Improvements
Diffstat (limited to 'web/src/js/components/common')
-rw-r--r--web/src/js/components/common/Button.jsx18
-rw-r--r--web/src/js/components/common/DocsLink.jsx14
2 files changed, 24 insertions, 8 deletions
diff --git a/web/src/js/components/common/Button.jsx b/web/src/js/components/common/Button.jsx
index bfbb455d..f05a68d0 100644
--- a/web/src/js/components/common/Button.jsx
+++ b/web/src/js/components/common/Button.jsx
@@ -1,19 +1,21 @@
-import React, { PropTypes } from 'react'
-import classnames from 'classnames'
+import React, { PropTypes } from "react"
+import classnames from "classnames"
Button.propTypes = {
onClick: PropTypes.func.isRequired,
- text: PropTypes.string,
- icon: PropTypes.string
+ children: PropTypes.node.isRequired,
+ icon: PropTypes.string,
+ title: PropTypes.string,
}
-export default function Button({ onClick, text, icon, disabled, className }) {
+export default function Button({ onClick, children, icon, disabled, className, title }) {
return (
<div className={classnames(className, 'btn btn-default')}
- onClick={onClick}
- disabled={disabled}>
+ onClick={!disabled && onClick}
+ disabled={disabled}
+ title={title}>
{icon && (<i className={"fa fa-fw " + icon}/> )}
- {text && text}
+ {children}
</div>
)
}
diff --git a/web/src/js/components/common/DocsLink.jsx b/web/src/js/components/common/DocsLink.jsx
new file mode 100644
index 00000000..182811a3
--- /dev/null
+++ b/web/src/js/components/common/DocsLink.jsx
@@ -0,0 +1,14 @@
+import { PropTypes } from 'react'
+
+DocsLink.propTypes = {
+ resource: PropTypes.string.isRequired,
+}
+
+export default function DocsLink({ children, resource }) {
+ let url = `http://docs.mitmproxy.org/en/stable/${resource}`
+ return (
+ <a target="_blank" href={url}>
+ {children || <i className="fa fa-question-circle"></i>}
+ </a>
+ )
+}