From c0fbd7cd6414a51fcfa576959df3477404dd5424 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 22 Jun 2016 22:12:52 +0300 Subject: [PATCH] Extract attachment list to its own component --- mail.js | 68 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/mail.js b/mail.js index 325e876..3bdf5b9 100644 --- a/mail.js +++ b/mail.js @@ -736,12 +736,11 @@ function formatDate(dt) return (h < 10 ? '0' : '')+h+':'+(m < 10 ? '0' : '')+m; } -var ComposeWindow = React.createClass({ +var AttachList = React.createClass({ getInitialState: function() { return { attachments: [], - text: '', attachScroll: 0 }; }, @@ -759,10 +758,6 @@ var ComposeWindow = React.createClass({ { this.setState({ attachScroll: ev.target.scrollTop }); }, - changeText: function(ev) - { - this.setState({ text: ev.target.value }); - }, attachKeyDown: function(ev) { if (!this.state.attachments.length) @@ -867,6 +862,44 @@ var ComposeWindow = React.createClass({ } }, render: function() + { + return
+
+ +
+
+
+
Attachment + + +
+
Size
+
+ {this.state.attachments.map((a, i) => +
+
{a.name}
+
{formatBytes(a.size)}
+
+ )} +
+
+ } +}); + +var ComposeWindow = React.createClass({ + getInitialState: function() + { + return { + text: '' + }; + }, + changeText: function(ev) + { + this.setState({ text: ev.target.value }); + }, + render: function() { return
@@ -903,28 +936,7 @@ var ComposeWindow = React.createClass({
-
-
- -
-
-
-
Attachment - - -
-
Size
-
- {this.state.attachments.map((a, i) => -
-
{a.name}
-
{formatBytes(a.size)}
-
- )} -
-
+