From e9a8bcd727e1bfbd98dc1955d1c574b76e9a4ad1 Mon Sep 17 00:00:00 2001
From: Florian Orben <florian.orben@gmail.com>
Date: Thu, 12 Nov 2015 00:23:00 +0100
Subject: PLT-327: Add help text for Markdown

---
 web/react/components/docs.jsx | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 web/react/components/docs.jsx

(limited to 'web/react/components/docs.jsx')

diff --git a/web/react/components/docs.jsx b/web/react/components/docs.jsx
new file mode 100644
index 000000000..68baa6dad
--- /dev/null
+++ b/web/react/components/docs.jsx
@@ -0,0 +1,41 @@
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+const TextFormatting = require('../utils/text_formatting.jsx');
+const UserStore = require('../stores/user_store.jsx');
+
+export default class Docs extends React.Component {
+    constructor(props) {
+        super(props);
+        UserStore.setCurrentUser(global.window.mm_user || {});
+
+        this.state = {text: ''};
+        const errorState = {text: '## 404'};
+
+        if (props.site) {
+            $.get('/static/help/' + props.site + '.md').then((response) => {
+                this.setState({text: response});
+            }, () => {
+                this.setState(errorState);
+            });
+        } else {
+            this.setState(errorState);
+        }
+    }
+
+    render() {
+        return (
+            <div
+                dangerouslySetInnerHTML={{__html: TextFormatting.formatText(this.state.text)}}
+            >
+            </div>
+        );
+    }
+}
+
+Docs.defaultProps = {
+    site: ''
+};
+Docs.propTypes = {
+    site: React.PropTypes.string
+};
-- 
cgit v1.2.3-1-g7c22

