From 24181bdf20e0d23ec5ec5d2eaa08ae1cfb905f0f Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Sun, 27 Aug 2017 04:19:11 +0200
Subject: better error report / retry prompt for failed payments

---
 src/webex/renderHtml.tsx | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

(limited to 'src/webex/renderHtml.tsx')

diff --git a/src/webex/renderHtml.tsx b/src/webex/renderHtml.tsx
index fe964e68a..2a5b50533 100644
--- a/src/webex/renderHtml.tsx
+++ b/src/webex/renderHtml.tsx
@@ -91,3 +91,40 @@ export function abbrev(s: string, n: number = 5) {
     </span>
   );
 }
+
+
+
+interface CollapsibleState {
+  collapsed: boolean;
+}
+
+interface CollapsibleProps {
+  initiallyCollapsed: boolean;
+  title: string;
+}
+
+export class Collapsible extends React.Component<CollapsibleProps, CollapsibleState> {
+  constructor(props: CollapsibleProps) {
+    super(props);
+    this.state = { collapsed: props.initiallyCollapsed };
+  }
+  render() {
+    const doOpen = (e: any) => {
+      this.setState({collapsed: false});
+      e.preventDefault();
+    };
+    const doClose = (e: any) => {
+      this.setState({collapsed: true});
+      e.preventDefault();
+    };
+    if (this.state.collapsed) {
+      return <h2><a className="opener opener-collapsed" href="#" onClick={doOpen}>{this.props.title}</a></h2>;
+    }
+    return (
+      <div>
+        <h2><a className="opener opener-open" href="#" onClick={doClose}>{this.props.title}</a></h2>
+        {this.props.children}
+      </div>
+    );
+  }
+}
-- 
cgit v1.2.3

