2016-04-10 02:00:56 +02:00
|
|
|
//component/icon.js
|
|
|
|
|
|
|
|
var Icon = React.createClass({
|
2016-04-15 12:41:01 +02:00
|
|
|
propTypes: {
|
|
|
|
style: React.PropTypes.object,
|
2016-08-07 17:27:00 +02:00
|
|
|
fixed: React.PropTypes.bool,
|
2016-04-15 12:41:01 +02:00
|
|
|
},
|
2016-04-10 02:00:56 +02:00
|
|
|
render: function() {
|
2016-05-27 13:07:21 +02:00
|
|
|
var className = 'icon ' + ('fixed' in this.props ? 'icon-fixed-width ' : '') + this.props.icon;
|
2016-04-15 12:41:01 +02:00
|
|
|
return <span className={className} style={this.props.style}></span>
|
2016-04-10 02:00:56 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-08-04 10:08:12 +02:00
|
|
|
var TruncatedText = React.createClass({
|
|
|
|
propTypes: {
|
2016-10-21 12:28:42 +02:00
|
|
|
lines: React.PropTypes.number,
|
|
|
|
height: React.PropTypes.string,
|
|
|
|
auto: React.PropTypes.bool,
|
2016-08-04 10:08:12 +02:00
|
|
|
},
|
|
|
|
getDefaultProps: function() {
|
|
|
|
return {
|
2016-10-21 12:28:42 +02:00
|
|
|
lines: null,
|
|
|
|
height: null,
|
|
|
|
auto: true,
|
2016-08-04 10:08:12 +02:00
|
|
|
}
|
|
|
|
},
|
2016-10-21 12:28:42 +02:00
|
|
|
componentDidMount: function() {
|
|
|
|
console.log('span is', this.refs.span);
|
|
|
|
console.log('type of lines is', typeof this.props.lines)
|
|
|
|
$clamp(this.refs.span, {
|
|
|
|
clamp: this.props.lines || this.props.height || 'auto',
|
|
|
|
});
|
|
|
|
},
|
2016-08-04 10:08:12 +02:00
|
|
|
render: function() {
|
|
|
|
var text = this.props.children;
|
2016-10-21 12:28:42 +02:00
|
|
|
return <span ref="span">{text}</span>;
|
2016-08-04 10:08:12 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-08-21 16:55:32 +02:00
|
|
|
var BusyMessage = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
message: React.PropTypes.string
|
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
return <span>{this.props.message} <span className="busy-indicator"></span></span>
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-07-26 14:01:54 +02:00
|
|
|
var toolTipStyle = {
|
|
|
|
position: 'absolute',
|
2016-07-27 12:24:10 +02:00
|
|
|
zIndex: '1',
|
2016-07-26 14:01:54 +02:00
|
|
|
top: '100%',
|
|
|
|
left: '-120px',
|
|
|
|
width: '260px',
|
|
|
|
padding: '15px',
|
|
|
|
border: '1px solid #aaa',
|
2016-07-27 12:24:10 +02:00
|
|
|
backgroundColor: '#fff',
|
2016-07-26 14:01:54 +02:00
|
|
|
fontSize: '14px',
|
|
|
|
};
|
|
|
|
var ToolTip = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
open: React.PropTypes.bool.isRequired,
|
|
|
|
onMouseOut: React.PropTypes.func
|
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<div className={this.props.open ? '' : 'hidden'} style={toolTipStyle} onMouseOut={this.props.onMouseOut}>
|
|
|
|
{this.props.children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-04-10 02:00:56 +02:00
|
|
|
var creditAmountStyle = {
|
|
|
|
color: '#216C2A',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: '0.8em'
|
|
|
|
}, estimateStyle = {
|
2016-08-19 09:15:13 +02:00
|
|
|
fontSize: '0.8em',
|
2016-04-10 02:00:56 +02:00
|
|
|
color: '#aaa',
|
|
|
|
};
|
|
|
|
|
2016-08-08 02:20:14 +02:00
|
|
|
var CurrencySymbol = React.createClass({
|
|
|
|
render: function() { return <span>LBC</span>; }
|
|
|
|
});
|
|
|
|
|
2016-04-10 02:00:56 +02:00
|
|
|
var CreditAmount = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
amount: React.PropTypes.number,
|
2016-08-27 16:12:56 +02:00
|
|
|
precision: React.PropTypes.number
|
2016-04-10 02:00:56 +02:00
|
|
|
},
|
|
|
|
render: function() {
|
2016-08-27 16:12:56 +02:00
|
|
|
var formattedAmount = lbry.formatCredits(this.props.amount, this.props.precision ? this.props.precision : 1);
|
2016-04-10 02:00:56 +02:00
|
|
|
return (
|
|
|
|
<span className="credit-amount">
|
2016-08-19 09:15:13 +02:00
|
|
|
<span style={creditAmountStyle}>{formattedAmount} {parseFloat(formattedAmount) == 1.0 ? 'credit' : 'credits'}</span>
|
|
|
|
{ this.props.isEstimate ? <span style={estimateStyle}> (est)</span> : null }
|
2016-04-10 02:00:56 +02:00
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
2016-05-23 16:24:23 +02:00
|
|
|
});
|
2016-09-01 08:40:23 +02:00
|
|
|
|
|
|
|
var addressStyle = {
|
|
|
|
fontFamily: '"Consolas", "Lucida Console", "Adobe Source Code Pro", monospace',
|
|
|
|
};
|
|
|
|
var Address = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
address: React.PropTypes.string,
|
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<span style={addressStyle}>{this.props.address}</span>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|