talk-message-forms
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -18,3 +18,3 @@ (function() { | ||
return div({ | ||
className: 'message-forms-default' | ||
className: 'attachment-default' | ||
}, this.props.attachment); | ||
@@ -21,0 +21,0 @@ } |
@@ -15,2 +15,3 @@ (function() { | ||
propTypes: { | ||
isUnread: T.bool, | ||
onClick: T.func, | ||
@@ -28,4 +29,5 @@ attachment: T.object.isRequired | ||
}, LiteAudio({ | ||
source: this.props.attachment.data.previewUrl, | ||
duration: this.props.attachment.data.duration | ||
duration: this.props.attachment.data.duration, | ||
isUnread: this.props.isUnread, | ||
source: this.props.attachment.data.previewUrl | ||
})); | ||
@@ -32,0 +34,0 @@ } |
@@ -11,3 +11,3 @@ (function() { | ||
module.exports = React.createClass({ | ||
displayName: 'message-form-default', | ||
displayName: 'message-form-mini-default', | ||
propTypes: { | ||
@@ -19,3 +19,3 @@ onClick: T.func, | ||
return div({ | ||
className: 'message-forms-default' | ||
className: 'attachment-mini-default' | ||
}, this.props.attachment); | ||
@@ -22,0 +22,0 @@ } |
@@ -11,79 +11,11 @@ (function() { | ||
module.exports = React.createClass({ | ||
displayName: 'message-form-file', | ||
displayName: 'message-form-mini-file', | ||
propTypes: { | ||
getColor: T.func, | ||
onClick: T.func, | ||
attachment: T.object.isRequired, | ||
eventBus: T.object, | ||
colors: T.oneOfType([T.array, T.object]) | ||
attachment: T.object.isRequired | ||
}, | ||
getInitialState: function() { | ||
return { | ||
progress: 0 | ||
}; | ||
}, | ||
componentDidMount: function() { | ||
if (this.props.eventBus != null) { | ||
if (this.props.attachment.data.fileKey == null) { | ||
return this.props.eventBus.addListener('uploader/progress', this.onProgress); | ||
} | ||
} | ||
}, | ||
componentWillUnoumt: function() { | ||
if (this.props.eventBus != null) { | ||
return eventBus.removeListener('uploader/progress', this.onProgress); | ||
} | ||
}, | ||
onClick: function() { | ||
var base; | ||
return typeof (base = this.props).onClick === "function" ? base.onClick() : void 0; | ||
}, | ||
onProgress: function(progress, data) { | ||
var fileName, fileSize, ref; | ||
ref = data.file, fileName = ref.fileName, fileSize = ref.fileSize; | ||
if ((fileName === this.props.data.fileName) && (fileSize === this.props.data.fileSize)) { | ||
if (this.isMounted()) { | ||
return this.setState({ | ||
progress: progress | ||
}); | ||
} | ||
} | ||
}, | ||
renderProgress: function() { | ||
if (this.props.eventBus != null) { | ||
if (this.props.data.fileKey == null) { | ||
return div({ | ||
className: 'progress', | ||
style: { | ||
width: (this.state.progress * 100) + "%" | ||
} | ||
}); | ||
} | ||
} | ||
}, | ||
renderFileType: function() { | ||
var ref, ref1, style; | ||
style = this.props.getColor != null ? { | ||
backgroundColor: this.props.getColor(this.props.attachment.data.fileType) | ||
} : ((ref = this.props.colors) != null ? ref.length : void 0) ? { | ||
backgroundColor: this.props.colors[this.props.attachment.data.fileType] || this.props.colors['default'] | ||
} : { | ||
backgroundColor: '#7986CB' | ||
}; | ||
return div({ | ||
className: 'file-type', | ||
style: style | ||
}, ((ref1 = this.props.attachment.data.fileType) != null ? ref1.length : void 0) ? this.props.attachment.data.fileType : '?'); | ||
}, | ||
renderFileName: function() { | ||
var ref; | ||
return div({ | ||
className: 'file-name' | ||
}, ((ref = this.props.attachment.data.fileName) != null ? ref.length : void 0) ? this.props.attachment.data.fileName : '?'); | ||
}, | ||
render: function() { | ||
return div({ | ||
className: 'attachment-file', | ||
onClick: this.onClick | ||
}, this.renderFileType(), this.renderFileName(), this.renderProgress()); | ||
className: 'attachment-mini-file' | ||
}, this.props.attachment); | ||
} | ||
@@ -90,0 +22,0 @@ }); |
(function() { | ||
var React, T, div, img; | ||
var React, T, div; | ||
@@ -8,8 +8,6 @@ React = require('react'); | ||
img = React.createFactory('img'); | ||
T = React.PropTypes; | ||
module.exports = React.createClass({ | ||
displayName: 'message-form-image', | ||
displayName: 'message-form-mini-image', | ||
propTypes: { | ||
@@ -19,15 +17,6 @@ onClick: T.func, | ||
}, | ||
onClick: function() { | ||
var base; | ||
return typeof (base = this.props).onClick === "function" ? base.onClick() : void 0; | ||
}, | ||
render: function() { | ||
return div({ | ||
className: 'attachment-image', | ||
onClick: this.onClick | ||
}, div({ | ||
className: 'preview' | ||
}, img({ | ||
src: this.props.attachment.data.thumbnailUrl | ||
}))); | ||
className: 'attachment-mini-image' | ||
}, this.props.attachment); | ||
} | ||
@@ -34,0 +23,0 @@ }); |
@@ -11,3 +11,3 @@ (function() { | ||
module.exports = React.createClass({ | ||
displayName: 'message-form-quote', | ||
displayName: 'message-form-mini-quote', | ||
propTypes: { | ||
@@ -17,40 +17,6 @@ onClick: T.func, | ||
}, | ||
onClick: function() { | ||
var base; | ||
return typeof (base = this.props).onClick === "function" ? base.onClick() : void 0; | ||
}, | ||
renderTitle: function() { | ||
var ref; | ||
if ((ref = this.props.attachment.data.title) != null ? ref.length : void 0) { | ||
return div({ | ||
className: 'title' | ||
}, this.props.attachment.data.title); | ||
} | ||
}, | ||
renderContent: function() { | ||
var ref; | ||
if ((ref = this.props.attachment.data.text) != null ? ref.length : void 0) { | ||
return div({ | ||
className: 'content' | ||
}, this.props.attachment.data.text); | ||
} | ||
}, | ||
renderPicture: function() { | ||
var style, url; | ||
if (this.props.attachment.data.thumbnailPicUrl != null) { | ||
url = this.props.attachment.data.thumbnailPicUrl; | ||
style = { | ||
backgroundImage: "url( " + url + " )" | ||
}; | ||
return div({ | ||
className: 'picture', | ||
style: style | ||
}); | ||
} | ||
}, | ||
render: function() { | ||
return div({ | ||
className: 'attachment-quote', | ||
onClick: this.onClick | ||
}, this.renderTitle(), this.renderContent(), this.renderPicture()); | ||
className: 'attachment-mini-quote' | ||
}, this.props.attachment); | ||
} | ||
@@ -57,0 +23,0 @@ }); |
(function() { | ||
var React, T, detect, div; | ||
var React, T, div; | ||
React = require('react'); | ||
detect = require('../util/detect'); | ||
div = React.createFactory('div'); | ||
@@ -13,3 +11,3 @@ | ||
module.exports = React.createClass({ | ||
displayName: 'message-form-rtf', | ||
displayName: 'message-form-mini-rtf', | ||
propTypes: { | ||
@@ -19,41 +17,6 @@ onClick: T.func, | ||
}, | ||
onClick: function() { | ||
var base; | ||
return typeof (base = this.props).onClick === "function" ? base.onClick() : void 0; | ||
}, | ||
renderTitle: function() { | ||
var ref; | ||
if ((ref = this.props.attachment.data.title) != null ? ref.length : void 0) { | ||
return div({ | ||
className: 'title' | ||
}, this.props.attachment.data.title); | ||
} | ||
}, | ||
renderContent: function() { | ||
var ref; | ||
if ((ref = this.props.attachment.data.text) != null ? ref.length : void 0) { | ||
return div({ | ||
className: 'content' | ||
}, this.props.attachment.data.text); | ||
} | ||
}, | ||
renderPicture: function() { | ||
var includeImage, style, url; | ||
includeImage = detect.extractURL(this.props.attachment.data.text); | ||
if (includeImage) { | ||
url = includeImage; | ||
style = { | ||
backgroundImage: "url( " + url + " )" | ||
}; | ||
return div({ | ||
className: 'picture', | ||
style: style | ||
}); | ||
} | ||
}, | ||
render: function() { | ||
return div({ | ||
className: 'attachment-rtf', | ||
onClick: this.onClick | ||
}, this.renderTitle(), this.renderContent(), this.renderPicture()); | ||
className: 'attachment-mini-rtf' | ||
}, this.props.attachment); | ||
} | ||
@@ -60,0 +23,0 @@ }); |
(function() { | ||
var LiteCodeViewer, React, T, div; | ||
var React, T, div; | ||
React = require('react'); | ||
LiteCodeViewer = React.createFactory(require('react-lite-coder').CodeViewer); | ||
div = React.createFactory('div'); | ||
@@ -13,41 +11,11 @@ | ||
module.exports = React.createClass({ | ||
displayName: 'message-form-snippet', | ||
displayName: 'message-form-mini-snippet', | ||
propTypes: { | ||
getCodeType: T.func, | ||
onClick: T.func, | ||
attachment: T.object.isRequired | ||
}, | ||
onClick: function() { | ||
var base; | ||
return typeof (base = this.props).onClick === "function" ? base.onClick() : void 0; | ||
}, | ||
renderTitle: function() { | ||
var ref; | ||
if ((ref = this.props.attachment.data.title) != null ? ref.length : void 0) { | ||
return div({ | ||
className: 'title' | ||
}, this.props.attachment.data.title); | ||
} | ||
}, | ||
renderContent: function() { | ||
var codeType, ref; | ||
if (this.props.getCodeType != null) { | ||
codeType = this.props.getCodeType(this.props.attachment.data.codeType); | ||
} else if ((ref = this.props.attachment.data.codeType) != null ? ref.length : void 0) { | ||
codeType = this.props.attachment.data.codeType; | ||
} else { | ||
codeType = 'nohighlight'; | ||
} | ||
return div({ | ||
className: 'content' | ||
}, LiteCodeViewer({ | ||
name: 'attachment-snippet', | ||
mode: codeType | ||
}, this.props.attachment.data.text)); | ||
}, | ||
render: function() { | ||
return div({ | ||
className: 'attachment-snippet', | ||
onClick: this.onClick | ||
}, this.renderTitle(), this.renderContent()); | ||
className: 'attachment-mini-snippet' | ||
}, this.props.attachment); | ||
} | ||
@@ -54,0 +22,0 @@ }); |
(function() { | ||
var LiteAudio, React, T, div; | ||
var React, T, div; | ||
React = require('react'); | ||
LiteAudio = React.createFactory(require('react-lite-audio')); | ||
div = React.createFactory('div'); | ||
@@ -13,3 +11,3 @@ | ||
module.exports = React.createClass({ | ||
displayName: 'message-form-speech', | ||
displayName: 'message-form-mini-speech', | ||
propTypes: { | ||
@@ -19,14 +17,6 @@ onClick: T.func, | ||
}, | ||
onClick: function() { | ||
var base; | ||
return typeof (base = this.props).onClick === "function" ? base.onClick() : void 0; | ||
}, | ||
render: function() { | ||
return div({ | ||
className: 'attachment-speech', | ||
onClick: this.onClick | ||
}, LiteAudio({ | ||
source: this.props.attachment.data.previewUrl, | ||
duration: this.props.attachment.data.duration | ||
})); | ||
className: 'attachment-mini-speech' | ||
}, this.props.attachment); | ||
} | ||
@@ -33,0 +23,0 @@ }); |
{ | ||
"name": "talk-message-forms", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "The Message Structure and Layout of jianliao.com", | ||
@@ -42,2 +42,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"prepublish": "gulp script", | ||
"build": "gulp build && gulp script", | ||
@@ -44,0 +45,0 @@ "dev": "gulp html && webpack-dev-server --hot", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31207
521