ucsc-xena-client
Version:
UCSC Xena Client. Functional genomics visualizations.
90 lines (71 loc) • 3.79 kB
JavaScript
/**
* UCSC Xena Client
* http://xena.ucsc.edu
*
* Card displayed after (wizard-based) setup is complete, contains column visualization.
*
* State
* -----
* colId - ID of column (eg 'A', 'B').
* controls - Icons and/or menu displayed at right of card title.
* title - Text or element displayed as title.
* subtitle - Text or element displayed as subtitle.
* wizardMode - True if currently in wizard mode.
*/
;
// Core dependencies, components
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _card = require('react-toolbox/lib/card');
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var React = require('react');
var classNames = require('classnames');
// App dependencies
var CardAvatar = require('./CardAvatar');
// Styles
var compStyles = require('./ColCard.module.css');
var ColCard = function (_React$Component) {
_inherits(ColCard, _React$Component);
function ColCard() {
_classCallCheck(this, ColCard);
return _possibleConstructorReturn(this, (ColCard.__proto__ || Object.getPrototypeOf(ColCard)).apply(this, arguments));
}
_createClass(ColCard, [{
key: 'render',
value: function render() {
var _props = this.props,
children = _props.children,
sortable = _props.sortable,
controls = _props.controls,
colId = _props.colId,
subtitle = _props.subtitle,
title = _props.title,
wizardMode = _props.wizardMode;
return React.createElement(
_card.Card,
{ className: 'Column' },
React.createElement(
'div',
{ className: classNames(compStyles.headerContainer, sortable && 'Sortable-handle') },
React.createElement(CardAvatar, { colId: colId }),
React.createElement(
'div',
{ className: compStyles.controls },
controls,
React.createElement('div', { className: classNames(compStyles.cover, _defineProperty({}, compStyles.showOnHover, !wizardMode)) })
)
),
React.createElement(
'div',
{ className: compStyles.titleContainer },
React.createElement(_card.CardTitle, { className: compStyles.title, title: title, subtitle: subtitle })
),
children
);
}
}]);
return ColCard;
}(React.Component);
module.exports = ColCard;