likeopera-frontend/ListSortSettingsWindow.js

38 lines
2.2 KiB
JavaScript

const React = require('react');
const DropDownBase = require('./DropDownBase.js');
const ListSortSettings = require('./ListSortSettings.js');
var ListSortSettingsWindow = module.exports = React.createClass({
mixins: [ DropDownBase ],
render: function()
{
var sort = this.props.override ? this.props.sorting : this.props.defaultSorting;
return <div ref="dd" onClick={this.onClick} className={'dropdown window list-sort'+(this.state.visible ? ' visible' : '')}
id={'dropdown-'+this.props.id} tabIndex="1" style={{ top: this.state.top, left: this.state.left }}>
<div ref="callout" className="callout-top" style={{ left: this.state.calloutLeft }}></div>
<div className="title">Sorting for {this.props.folder}</div>
<label><input type="checkbox" checked={this.props.override ? "checked" : null} /> Override default sorting</label>
<ListSortSettings className="sorting" sort={sort} />
<div className="show">
<a className="button" onClick={this.expandChecks}><span className={this.state.checksVisible ? 'collapse' : 'expand'}></span> Show</a>
</div>
<div className="show-checks" style={{ display: this.state.checksVisible ? null : 'none' }}>
<label><input type="checkbox" checked={this.props.show.read ? "checked" : null} /> Show Read</label>
<label><input type="checkbox" checked={this.props.show.trash ? "checked" : null} /> Show Trash</label>
<label><input type="checkbox" checked={this.props.show.spam ? "checked" : null} /> Show Spam</label>
<label><input type="checkbox" checked={this.props.show.lists ? "checked" : null} /> Show Mailing Lists</label>
<label><input type="checkbox" checked={this.props.show.sent ? "checked" : null} /> Show Sent</label>
<label><input type="checkbox" checked={this.props.show.dups ? "checked" : null} /> Show Duplicates</label>
</div>
</div>
},
getInitialState: function()
{
return { checksVisible: false };
},
expandChecks: function()
{
this.setState({ checksVisible: !this.state.checksVisible });
}
});